-
Notifications
You must be signed in to change notification settings - Fork 0
/
lsp.vim
149 lines (143 loc) · 4.26 KB
/
lsp.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
let lspOpts = #{
\ aleSupport: v:false,
\ autoComplete: v:true,
\ autoHighlight: v:true,
\ autoHighlightDiags: v:true,
\ autoPopulateDiags: v:true,
\ completionMatcher: 'case',
\ completionMatcherValue: 1,
\ diagSignErrorText: '❗',
\ diagSignHintText: '💡',
\ diagSignInfoText: '💡',
\ diagSignWarningText: '💡',
\ echoSignature: v:false,
\ hideDisabledCodeActions: v:false,
\ highlightDiagInline: v:true,
\ hoverInPreview: v:true,
\ ignoreMissingServer: v:false,
\ keepFocusInDiags: v:true,
\ keepFocusInReferences: v:true,
\ completionTextEdit: v:true,
\ diagVirtualTextAlign: 'above',
\ noNewlineInCompletion: v:false,
\ omniComplete: v:null,
\ outlineOnRight: v:false,
\ outlineWinSize: 20,
\ semanticHighlight: v:false,
\ showDiagInBalloon: v:false,
\ showDiagInPopup: v:true,
\ showDiagOnStatusLine: v:false,
\ showDiagWithSign: v:true,
\ showDiagWithVirtualText: v:false,
\ showInlayHints: v:false,
\ showSignature: v:true,
\ snippetSupport: v:true,
\ ultisnipsSupport: v:false,
\ useBufferCompletion: v:false,
\ usePopupInCodeAction: v:true,
\ useQuickfixForLocations: v:false,
\ vsnipSupport: v:true,
\ bufferCompletionTimeout: 100,
\ customCompletionKinds: v:false,
\ completionKinds: {}
\ }
autocmd User LspSetup call LspOptionsSet(lspOpts)
let lspServers = [
\
\ #{name: 'clang',
\ filetype: ['c', 'cpp'],
\ path: '/usr/bin/clangd',
\ args: ['--background-index']
\ },
\
\ #{name: 'bashls',
\ filetype: 'sh',
\ path: '/usr/bin/bash-language-server',
\ args: ['start']
\ },
\
\ #{name: 'bitbake',
\ filetype: 'bitbake',
\ path: '/usr/bin/bitbake-language-server'
\ },
\
\ #{name: 'pyright',
\ filetype: 'python',
\ path: '/usr/bin/pyright-langserver',
\ args: ['--stdio'],
\ workspaceConfig: #{
\ python: #{
\ pythonPath: '/usr/bin/python3.11'
\ }
\ }
\ },
\
\ #{name: 'rustanalyzer',
\ filetype: ['rust'],
\ path: '/usr/bin/rust-analyzer',
\ args: [],
\ syncInit: v:true
\ },
\
\ #{name: 'sonarlint-ls',
\ filetype: ['c',
\ 'cpp',
\ 'go',
\ 'html',
\ 'java',
\ 'javascript',
\ 'php',
\ 'python',
\ 'terraform',
\ 'xml'],
\ path: '/usr/bin/sonarlint-ls',
\ args: [
\ '-stdio',
\ '-analyzers',
\ '/usr/share/java/sonarlint-ls/analyzers/sonarcfamily.jar',
\ '/usr/share/java/sonarlint-ls/analyzers/sonargo.jar',
\ '/usr/share/java/sonarlint-ls/analyzers/sonarhtml.jar',
\ '/usr/share/java/sonarlint-ls/analyzers/sonariac.jar',
\ '/usr/share/java/sonarlint-ls/analyzers/sonarjava.jar',
\ '/usr/share/java/sonarlint-ls/analyzers/sonarjs.jar',
\ '/usr/share/java/sonarlint-ls/analyzers/sonarlintomnisharp.jar',
\ '/usr/share/java/sonarlint-ls/analyzers/sonarphp.jar',
\ '/usr/share/java/sonarlint-ls/analyzers/sonarpython.jar',
\ '/usr/share/java/sonarlint-ls/analyzers/sonartext.jar',
\ '/usr/share/java/sonarlint-ls/analyzers/sonarxml.jar',
\ ],
\ debug: v:true,
\ syncInit: v:true,
\ workspaceConfig: #{
\ sonarlint: #{
\ pathToCompileCommands: "${workspaceFolder}/build/compile_commands.json"
\ }
\ },
\ initializationOptions: #{
\ productKey: 'vscode',
\ telemetryStorage: '~/.vim-playground/telemetry/sonarlint_usage',
\ productName: 'SonarLint VSCode',
\ showVerboseLogs: v:true,
\ platform: 'linux',
\ architecture: 'x64',
\ additionalAttributes: #{
\ vscode: #{
\ isTelemetryEnabled: v:false,
\ },
\ },
\ },
\ },
\ #{name: 'vimls',
\ filetype: 'vim',
\ path: '/usr/bin/vim-language-server',
\ args: ['--stdio']
\ }
\]
autocmd VimEnter * call LspAddServer(lspServers)
inoremap <expr> <C-j> pumvisible() ? "\<C-n>" : "\<C-j>"
inoremap <expr> <C-k> pumvisible() ? "\<C-p>" : "\<C-k>"
nmap <leader>qf :LspCodeAction 1<CR>
nmap <silent>[g :LspDiagPrev<CR>
nmap <silent>]g :LspDiagNext<CR>
nmap <leader>pe :LspDiagPrev<CR>
nmap <leader>ne :LspDiagNext<CR>