]> Sergey Matveev's repositories - dotfiles.git/blobdiff - vim/.vim/plugin/lsp.vim
gomod is also LSPable
[dotfiles.git] / vim / .vim / plugin / lsp.vim
index c5e1c90ac8b51cc098c98925560e42a927275523..c0cb4462fe4b924ec7bed7a51ae88f43d463fcb2 100644 (file)
@@ -3,21 +3,22 @@ vim9script
 # go get golang.org/x/tools/gopls@latest
 # pip install 'python-language-server[all]'
 
-var lspServers = [
+var lspServers: list<dict<any>>
+
+for d in [
     {
         filetype: ["c", "cpp"],
         path: "clangd",
         args: ["--log=error"],
     },
     {
-        filetype: ["go"],
+        filetype: ["go", "gomod"],
         path: "gopls",
         syncInit: true,
     },
     {
         filetype: ["python"],
         path: "pyls",
-        args: ["-v"],
         syncInit: true,
         workspaceConfig: {pyls: {
             configurationSources: ["flake8"],
@@ -25,18 +26,24 @@ var lspServers = [
                 mccabe: {enabled: false},
             },
         }},
-    }
+    },
 ]
+    if executable(d["path"])
+        add(lspServers, d)
+    endif
+endfor
+
 var lspOpts = {
     ignoreMissingServer: true,
     autoComplete: false,
     autoHighlight: true,
     autoPopulateDiags: true,
-    showInlayHints: true,
+    showSignature: false,
 }
 
 autocmd VimEnter * call LspAddServer(lspServers)
 autocmd VimEnter * call LspOptionsSet(lspOpts)
+autocmd CursorMoved * silent! LspDiagCurrent
 nmap gd :LspGotoDefinition<CR>
 nmap <C-W>gd :vert LspGotoDefinition<CR>
 nmap <F6> :lopen<CR>