|
| 1 | +vim9script |
| 2 | + |
| 3 | +var lspOpts = { |
| 4 | + aleSupport: false, |
| 5 | + autoComplete: false, |
| 6 | + autoHighlight: false, |
| 7 | + autoHighlightDiags: true, |
| 8 | + autoPopulateDiags: false, |
| 9 | + completionMatcher: 'case', |
| 10 | + completionMatcherValue: 1, |
| 11 | + diagSignErrorText: 'E>', |
| 12 | + diagSignHintText: 'H>', |
| 13 | + diagSignInfoText: 'I>', |
| 14 | + diagSignWarningText: 'W>', |
| 15 | + echoSignature: false, |
| 16 | + hideDisabledCodeActions: false, |
| 17 | + highlightDiagInline: true, |
| 18 | + hoverInPreview: false, |
| 19 | + ignoreMissingServer: false, |
| 20 | + keepFocusInDiags: true, |
| 21 | + keepFocusInReferences: true, |
| 22 | + completionTextEdit: false, |
| 23 | + diagVirtualTextAlign: 'above', |
| 24 | + diagVirtualTextWrap: 'default', |
| 25 | + noNewlineInCompletion: false, |
| 26 | + omniComplete: true, |
| 27 | + outlineOnRight: false, |
| 28 | + outlineWinSize: 30, |
| 29 | + semanticHighlight: true, |
| 30 | + showDiagInBalloon: true, |
| 31 | + showDiagInPopup: true, |
| 32 | + showDiagOnStatusLine: false, |
| 33 | + showDiagWithSign: true, |
| 34 | + showDiagWithVirtualText: true, |
| 35 | + showInlayHints: true, |
| 36 | + showSignature: true, |
| 37 | + snippetSupport: false, |
| 38 | + ultisnipsSupport: false, |
| 39 | + useBufferCompletion: false, |
| 40 | + usePopupInCodeAction: true, |
| 41 | + useQuickfixForLocations: false, |
| 42 | + vsnipSupport: false, |
| 43 | + bufferCompletionTimeout: 100, |
| 44 | + customCompletionKinds: false, |
| 45 | + completionKinds: {}, |
| 46 | + filterCompletionDuplicates: false, |
| 47 | +} |
| 48 | + |
| 49 | + |
| 50 | +var lspServers = [ |
| 51 | + # Clangd language server |
| 52 | + { |
| 53 | + name: 'clang', |
| 54 | + filetype: ['c', 'cpp'], |
| 55 | + path: 'clangd-mp-17', |
| 56 | + args: ['--background-index'], |
| 57 | + }, |
| 58 | + |
| 59 | + # Rust language server |
| 60 | +# { |
| 61 | +# name: 'rustlang', |
| 62 | +# filetype: ['rust'], |
| 63 | +# path: '/usr/local/bin/rust-analyzer', |
| 64 | +# args: [], |
| 65 | +# syncInit: true, |
| 66 | +# }, |
| 67 | + |
| 68 | +# Go language server |
| 69 | + { |
| 70 | + name: 'golang', |
| 71 | + filetype: ['go', 'gomod'], |
| 72 | + path: 'gopls', |
| 73 | + args: ['serve'], |
| 74 | + syncInit: true, |
| 75 | + initializationOptions: { |
| 76 | + semanticTokens: true, |
| 77 | + }, |
| 78 | + }, |
| 79 | + |
| 80 | + # Javascript/Typescript language server |
| 81 | + { |
| 82 | + name: 'typescriptlang', |
| 83 | + filetype: ['javascript', 'typescript'], |
| 84 | + path: 'typescript-language-server', |
| 85 | + args: ['--stdio'], |
| 86 | + }, |
| 87 | +] |
| 88 | + |
| 89 | +augroup Lsp |
| 90 | + au! |
| 91 | + autocmd User LspSetup call LspOptionsSet(lspOpts) |
| 92 | + autocmd User LspSetup call LspAddServer(lspServers) |
| 93 | + autocmd User LspAttached { |
| 94 | + setlocal keywordprg=:LspHover |
| 95 | + setlocal tagfunc=lsp#lsp#TagFunc |
| 96 | + setlocal formatexpr=lsp#lsp#FormatExpr() |
| 97 | + nnoremap <buffer> <LocalLeader>f <Cmd>LspFormat<CR> |
| 98 | + } |
| 99 | +augroup END |
0 commit comments