From 7d1e8075b8f156f3f8c300326abf730a1a8f2875 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Mon, 31 May 2021 22:20:30 +0200 Subject: Copying of Luke's dots --- .config/nvim/lua/lsp/init.lua | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to '.config/nvim/lua/lsp/init.lua') diff --git a/.config/nvim/lua/lsp/init.lua b/.config/nvim/lua/lsp/init.lua index b07858b..ef2e2f9 100644 --- a/.config/nvim/lua/lsp/init.lua +++ b/.config/nvim/lua/lsp/init.lua @@ -1,19 +1,19 @@ -- TODO figure out why this don't work vim.fn.sign_define( "LspDiagnosticsSignError", - {texthl = "LspDiagnosticsSignError", text = "", numhl = "LspDiagnosticsSignError"} + {texthl = "LspDiagnosticsSignError", text = "", numhl = "LspDiagnosticsSignError"} ) vim.fn.sign_define( "LspDiagnosticsSignWarning", - {texthl = "LspDiagnosticsSignWarning", text = "", numhl = "LspDiagnosticsSignWarning"} + {texthl = "LspDiagnosticsSignWarning", text = "", numhl = "LspDiagnosticsSignWarning"} ) vim.fn.sign_define( "LspDiagnosticsSignHint", - {texthl = "LspDiagnosticsSignHint", text = "", numhl = "LspDiagnosticsSignHint"} + {texthl = "LspDiagnosticsSignHint", text = "", numhl = "LspDiagnosticsSignHint"} ) vim.fn.sign_define( "LspDiagnosticsSignInformation", - {texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation"} + {texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation"} ) vim.cmd("nnoremap gd lua vim.lsp.buf.definition()") @@ -21,7 +21,7 @@ vim.cmd("nnoremap gD lua vim.lsp.buf.declaration()") vim.cmd("nnoremap gr lua vim.lsp.buf.references()") vim.cmd("nnoremap gi lua vim.lsp.buf.implementation()") vim.cmd("nnoremap ca :Lspsaga code_action") -vim.cmd("nnoremap K :Lspsaga hoer_doc") +vim.cmd("nnoremap K :Lspsaga hover_doc") -- vim.cmd('nnoremap lua vim.lsp.buf.signature_help()') vim.cmd("nnoremap :Lspsaga diagnostic_jump_prev") vim.cmd("nnoremap :Lspsaga diagnostic_jump_next") @@ -31,6 +31,19 @@ vim.cmd("nnoremap lua require('lspsaga.action').smart_scroll vim.cmd("nnoremap lua require('lspsaga.action').smart_scroll_with_saga(-1)") vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()') +-- Set Default Prefix. +-- Note: You can set a prefix per lsp server in the lv-globals.lua file +vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( + vim.lsp.diagnostic.on_publish_diagnostics, { + virtual_text = { + prefix = "", + spacing = 0, + }, + signs = true, + underline = true, + } +) + -- symbols for autocomplete vim.lsp.protocol.CompletionItemKind = { "  (Text) ", @@ -47,7 +60,7 @@ vim.lsp.protocol.CompletionItemKind = { "  (Value)", " 練 (Enum)", "  (Keyword)", - " ﬌ (Snippet)", + "  (Snippet)", "  (Color)", "  (File)", "  (Reference)", @@ -87,8 +100,10 @@ local function documentHighlight(client, bufnr) end local lsp_config = {} -function lsp_config.common_on_attach(client, bufnr) - documentHighlight(client, bufnr) +if O.document_highlight then + function lsp_config.common_on_attach(client, bufnr) + documentHighlight(client, bufnr) + end end function lsp_config.tsserver_on_attach(client, bufnr) -- cgit v1.2.3-70-g09d2