forked from autozimu/LanguageClient-neovim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLanguageClient.txt
370 lines (243 loc) · 11.8 KB
/
LanguageClient.txt
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
*LanguageClient* Language Server Protocol support for neovim
==============================================================================
CONTENTS *LanguageClientContents*
1. Usage ....................... |LanguageClientUsage|
2. Configuration ............... |LanguageClientConfiguration|
3. Commands .................... |LanguageClientCommands|
4. Functions ................... |LanguageClientFunctions|
5. Events ...................... |LanguageClientEvents|
6. License ..................... |LanguageClientLicense|
7. Bugs ........................ |LanguageClientBugs|
8. Contributing ................ |LanguageClientContributing|
==============================================================================
1. Usage *LanguageClientUsage*
Before using of LanguageClient, it is necessary to specify commands that are
going to be used to start language server. See |LanguageClient_serverCommands|
for detail. Here is a simple example config: >
let g:LanguageClient_serverCommands = {
\ 'rust': ['rustup', 'run', 'nightly', 'rls'],
\ }
After that, open a file with one of the above filetypes, functionalities
provided by language servers should be available out of the box.
At this point, call any provided function as you like. See
|LanguageClientFunctions| for a complete list of functions. Usually one would
like to map these functions to shortcuts, for example: >
nnoremap <silent> K :call LanguageClient_textDocument_hover()<CR>
nnoremap <silent> gd :call LanguageClient_textDocument_definition()<CR>
nnoremap <silent> <F2> :call LanguageClient_textDocument_rename()<CR>
If one is using deoplete/nvim-completion-manager at the same time, completion
should work out of the box. Otherwise, completion is available with 'C-X C-O'
('omnifunc').
Alternatively, set 'completefunc': >
set completefunc=LanguageClient#complete
<
If the language server supports, diagnostic/lint information will be displayed
via gutter and syntax highlighting with real time editing. At the same time,
those info are populated into quickfix list (or location list), which can be
accessed by regular quickfix/location list operations.
To use the language server with Vim's formatting operator |gq|, set 'formatexpr': >
set formatexpr=LanguageClient_textDocument_rangeFormatting()
<
==============================================================================
2. Configuration *LanguageClientConfiguration*
2.1 g:LanguageClient_serverCommands *g:LanguageClient_serverCommands*
String to list map. Defines commands to start language server for specific
filetype. For example: >
let g:LanguageClient_serverCommands = {
\ 'rust': ['rustup', 'run', 'nightly', 'rls'],
\ }
Default: {}
2.2 g:LanguageClient_diagnosticsDisplay *g:LanguageClient_diagnosticsDisplay*
Control how diagnostics messages are displayed.
Default: >
{
1: {
"name": "Error",
"texthl": "ALEError",
"signText": "✖",
"signTexthl": "ALEErrorSign",
},
2: {
"name": "Warning",
"texthl": "ALEWarning",
"signText": "⚠",
"signTexthl": "ALEWarningSign",
},
3: {
"name": "Information",
"texthl": "ALEInfo",
"signText": "ℹ",
"signTexthl": "ALEInfoSign",
},
4: {
"name": "Hint",
"texthl": "ALEInfo",
"signText": "➤",
"signTexthl": "ALEInfoSign",
},
}
2.4 g:LanguageClient_changeThrottle *g:LanguageClient_changeThrottle*
Interval in seconds during which textDocument_didChange is suppressed. For
example: >
let g:LanguageClient_changeThrottle = 0.5
This will make LanguageClient pause 0.5 second to send text changes to server
after one textDocument_didChange is sent.
Default: 0. No throttling.
2.5 g:LanguageClient_autoStart *g:LanguageClient_autoStart*
Whether to start language servers automatically when opening a file of
associated filetype.
Default: 1.
2.6 g:LanguageClient_selectionUI *g:LanguageClient_selectionUI*
Selection UI used when there are multiple entries.
Default: If fzf is loaded, use "fzf", otherwise use "location-list".
Valid options: "fzf" | "location-list"
2.7 g:LanguageClient_trace *g:LanguageClient_trace*
Trace setting passed to server.
Default: "off"
Valid options: "off" | "messages" | "verbose"
2.8 g:LanguageClient_diagnosticsList *g:LanguageClient_diagnosticsList*
List used to fill diagnostic messages.
Default: "quickfix"
Valid options: "quickfix" | "location" | ""
2.9 g:LanguageClient_diagnosticsEnable *g:LanguageClient_diagnosticsEnable*
Whether to handle diagnostic messages, including gutter, highlight and
quickfix/location list.
Default: 1
Valid options: 1 | 0
2.10 g:LanguageClient_windowLogMessageLevel *g:LanguageClient_windowLogMessageLevel*
Maximum MessageType to show messages from window/logMessage notifications.
Default: "Warning"
Valid options: "Error" | "Warning" | "Info" | "Log"
2.11 g:LanguageClient_settingsPath *g:LanguageClient_settingsPath*
Default path for language server settings
Default: ".vim/settings.json"
2.12 g:LanguageClient_loadSettings *g:LanguageClient_loadSettings*
Whether to load language server settings.
Default: 0
Valid options: 1 | 0
2.13 g:LanguageClient_loggingLevel *g:LanguageClient_loggingLevel*
Logging level.
Default: 'WARN'
Valid options: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR'
2.14 g:LanguageClient_rootMarkers *g:LanguageClient_rootMarkers*
Customized project root markers. Generally a heuristic algorithm within this
plugin should be able to detect project root automatically. This option is
provided in case the algorithm failed.
Example setting 1. List of string array. Shell-like glob is supported. >
let g:LanguageClient_rootMarkers = ['.root', 'project.*']
Example setting 2. Map filetype to string array. >
let g:LanguageClient_rootMarkers = {
\ 'javascript': ['project.json'],
\ 'rust': ['Cargo.toml'],
\ }
Default: v:null
Valid option: Array<String> | Map<String, Array<String>>
2.15 g:LanguageClient_fzfOptions *g:LanguageClient_fzfOptions*
Customize fzf. Check fzf documentation for available options.
Default: v:null
Valid option: Array<String> | String
==============================================================================
3. Commands *LanguageClientCommands*
3.1 LanguageClientStart *LanguageClientStart*
Start language server for current buffer.
3.2 LanguageClientStop *LanguageClientStop*
Stop current language server.
==============================================================================
4. Functions *LanguageClientFunctions*
4.1 LanguageClient_textDocument_hover()
*LanguageClient_textDocument_hover*
Show type info (and short doc) of identifier under cursor.
4.2 LanguageClient_textDocument_definition()
*LanguageClient_textDocument_definition*
Goto definition of identifier under cursor.
4.3 LanguageClient_textDocument_rename()
*LanguageClient_textDocument_rename*
Rename identifier under cursor.
4.4 LanguageClient_textDocument_documentSymbol()
*LanguageClient_textDocument_documentSymbol*
List of current buffer's symbols.
If optional dependency FZF is installed, symbols will be displayed in a FZF
prompt, selecting one of the symbol will then goto the symbol's definition.
For Denite users, a source with name 'documentSymbol' is provided.
4.5 LanguageClient_textDocument_references()
*LanguageClient_textDocument_references*
List all references of identifier under cursor.
If optional dependency FZF is installed, locations will be displayed in a FZF
prompt, selecting one of the entry will then goto the reference location.
For Denite users, a source with name 'references' is provided.
4.6 LanguageClient_workspace_symbol()
*LanguageClient_workspace_symbol*
List of project's symbols.
If optional dependency FZF is installed, symbols will be displayed in a FZF
prompt, selecting one of the symbol will then goto the symbol's definition.
For Denite users, a source with name 'workspaceSymbol' is provided.
4.7 LanguageClient_textDocument_completion()
*LanguageClient_textDocument_completion*
Get a list of completion items at current editing location. Note, this is an
synchronous call.
When using a supported completion manager (deoplete and
nvim-completion-manager are supported), completion should work out of the box.
4.8 LanguageClient_setLoggingLevel(level: str)
*LanguageClient_setLoggingLevel*
Set the plugin logging level. By default, only errors are logged into
/tmp/LanguageClient.log (%TMP%/LanguageClient.log for Windows).
Valid logging levels are 'ERROR'(default), 'INFO', 'DEBUG'.
4.9 LanguageClient_textDocument_formatting()
*LanguageClient_textDocument_formatting*
Format current document.
4.10 LanguageClient_textDocument_rangeFormatting()
*LanguageClient_textDocument_rangeFormatting*
Format selected lines.
4.11 LanguageClient#Notify(method: str, params: Dict)
*LanguageClient#Notify*
Send a notification to the current language server.
4.12 LanguageClient#Call(method: str, params: Dict, callback: function | list)
*LanguageClient#Call*
Call a method to the current language server.
4.12 LanguageClient_serverStatus() *LanguageClient_serverStatus*
Get language server status. 0 for server idle. 1 for server busy.
4.13 LanguageClient_serverStatusMessage()
*LanguageClient_serverStatusMessage*
Get a detail message of server status.
4.14 LanguageClient_statusLine() *LanguageClient_statusLine*
Example status line making use of LanguageClient_serverStatusMessage.
4.15 LanguageClient_workspace_applyEdit(params: Dict, callback: function | list)
*LanguageClient_workspace_applyEdit*
Apply a workspace edit.
==============================================================================
5. Events *LanguageClientEvents*
LanguageClient provides two events for use with |User| |autocmd|s.
5.1 LanguageClientStarted
*LanguageClientStarted*
This event is triggered after LanguageClient has successfully started.
5.2 LanguageClientStopped
*LanguageClientStopped*
This event is triggered after LanguageClient has stopped.
Example: >
augroup LanguageClient_config
autocmd!
autocmd User LanguageClientStarted setlocal signcolumn=yes
autocmd User LanguageClientStopped setlocal signcolumn=auto
augroup END
5.3 LanguageClientDiagnosticsChanged
*LanguageClientDiagnosticsChanged*
This event is triggered when diagnostics changed.
==============================================================================
6. License *LanguageClientLicense*
The MIT License.
==============================================================================
7. Bugs *LanguageClientBugs*
Please report all bugs at https://github.com/autozimu/LanguageClient-neovim/issues
If you believe you've find a bug in this plugin, please first try to help
narrow down where the error happens, which will reduce bug fix time/effort
tremendously.
Try increasing logging level to 'INFO' or 'DEBUG' using the
|LanguageClient_setLoggingLevel| function, and check the log file.
There is also an utility script in: >
$RUNTIME/rplugin/python3/LanguageClient/wrapper.sh
which can work like a proxy and logs all stdin and stdout of the language
server into a log file.
==============================================================================
8. Contributing *LanguageClientContributing*
https://github.com/autozimu/LanguageClient-neovim
vim: ft=help