diff options
Diffstat (limited to '.config/nvim/lua/lsp')
-rw-r--r-- | .config/nvim/lua/lsp/efm-general-ls.lua | 4 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/go-ls.lua | 7 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/init.lua | 31 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/python-ls.lua | 11 |
4 files changed, 43 insertions, 10 deletions
diff --git a/.config/nvim/lua/lsp/efm-general-ls.lua b/.config/nvim/lua/lsp/efm-general-ls.lua index 16f3037..01bc3ee 100644 --- a/.config/nvim/lua/lsp/efm-general-ls.lua +++ b/.config/nvim/lua/lsp/efm-general-ls.lua @@ -92,7 +92,7 @@ require"lspconfig".efm.setup { -- init_options = {initializationOptions}, cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"}, init_options = {documentFormatting = true, codeAction = false}, - filetypes = {"lua", "python", "javascriptreact", "javascript", "sh", "html", "css", "json", "yaml", "markdown"}, + filetypes = {"lua", "python", "javascriptreact", "javascript", "typescript","typescriptreact","sh", "html", "css", "json", "yaml", "markdown", "vue"}, settings = { rootMarkers = {".git/"}, languages = { @@ -101,6 +101,8 @@ require"lspconfig".efm.setup { sh = sh_arguments, javascript = tsserver_args, javascriptreact = tsserver_args, + typescript = tsserver_args, + typescriptreact = tsserver_args, html = {prettier}, css = {prettier}, json = {prettier}, diff --git a/.config/nvim/lua/lsp/go-ls.lua b/.config/nvim/lua/lsp/go-ls.lua new file mode 100644 index 0000000..1311247 --- /dev/null +++ b/.config/nvim/lua/lsp/go-ls.lua @@ -0,0 +1,7 @@ +require'lspconfig'.gopls.setup{ + cmd = {DATA_PATH .. "/lspinstall/go/gopls"}, + settings = {gopls = {analyses = {unusedparams = true}, staticcheck = true}}, + root_dir = require'lspconfig'.util.root_pattern(".git","go.mod","."), + init_options = {usePlaceholders = true, completeUnimported = true}, + on_attach = require'lsp'.common_on_attach +} 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 <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>") @@ -21,7 +21,7 @@ vim.cmd("nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>") vim.cmd("nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>") vim.cmd("nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>") vim.cmd("nnoremap <silent> ca :Lspsaga code_action<CR>") -vim.cmd("nnoremap <silent> K :Lspsaga hoer_doc<CR>") +vim.cmd("nnoremap <silent> K :Lspsaga hover_doc<CR>") -- vim.cmd('nnoremap <silent> <C-k> <cmd>lua vim.lsp.buf.signature_help()<CR>') vim.cmd("nnoremap <silent> <C-p> :Lspsaga diagnostic_jump_prev<CR>") vim.cmd("nnoremap <silent> <C-n> :Lspsaga diagnostic_jump_next<CR>") @@ -31,6 +31,19 @@ vim.cmd("nnoremap <silent> <C-f> <cmd>lua require('lspsaga.action').smart_scroll vim.cmd("nnoremap <silent> <C-b> <cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<CR>") 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) diff --git a/.config/nvim/lua/lsp/python-ls.lua b/.config/nvim/lua/lsp/python-ls.lua index 8cc8b22..d4dfac5 100644 --- a/.config/nvim/lua/lsp/python-ls.lua +++ b/.config/nvim/lua/lsp/python-ls.lua @@ -1,3 +1,4 @@ + -- npm i -g pyright require'lspconfig'.pyright.setup { cmd = {DATA_PATH .. "/lspinstall/python/node_modules/.bin/pyright-langserver", "--stdio"}, @@ -8,7 +9,15 @@ require'lspconfig'.pyright.setup { signs = O.python.diagnostics.signs, underline = O.python.diagnostics.underline, update_in_insert = true - }) + }, + settings = { + python = { + analysis = { + typeCheckingMode = O.python.analysis.type_checking, + autoSearchPaths = O.python.analysis.auto_search_paths, + useLibraryCodeForTypes = O.python.analysis.use_library_code_types + } + } } } |