All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 *vim-lsp.txt* Async Language Server Protocol (LSP) for Vim 8 and Neovim.
4 ==============================================================================
5 CONTENTS *vim-lsp-contents*
7 Introduction |vim-lsp-introduction|
8 Install |vim-lsp-install|
9 Performance |vim-lsp-performance|
10 Language Servers |vim-lsp-language-servers|
11 Configure |vim-lsp-configure|
12 vim-lsp-settings |vim-lsp-settings_plugin|
13 Wiki |vim-lsp-configure-wiki|
14 Health Check |vim-lsp-healthcheck|
15 Options |vim-lsp-options|
16 g:lsp_auto_enable |g:lsp_auto_enable|
17 g:lsp_use_native_client |g:lsp_use_native_client|
18 g:lsp_preview_keep_focus |g:lsp_preview_keep_focus|
19 g:lsp_preview_float |g:lsp_preview_float|
20 g:lsp_preview_autoclose |g:lsp_preview_autoclose|
21 g:lsp_preview_doubletap |g:lsp_preview_doubletap|
22 g:lsp_insert_text_enabled |g:lsp_insert_text_enabled|
23 g:lsp_text_edit_enabled |g:lsp_text_edit_enabled|
24 g:lsp_completion_documentation_enabled
25 |g:lsp_completion_documentation_enabled|
26 g:lsp_completion_documentation_delay
27 |g:lsp_completion_documentation_delay|
28 g:lsp_diagnostics_enabled |g:lsp_diagnostics_enabled|
29 g:lsp_diagnostics_echo_cursor |g:lsp_diagnostics_echo_cursor|
30 g:lsp_diagnostics_echo_delay |g:lsp_diagnostics_echo_delay|
31 g:lsp_diagnostics_float_cursor |g:lsp_diagnostics_float_cursor|
32 g:lsp_diagnostics_float_delay |g:lsp_diagnostics_float_delay|
33 g:lsp_diagnostics_float_insert_mode_enabled
34 |g:lsp_diagnostics_float_insert_mode_enabled|
35 g:lsp_diagnostics_highlights_enabled
36 |g:lsp_diagnostics_highlights_enabled|
37 g:lsp_diagnostics_highlights_insert_mode_enabled
38 |g:lsp_diagnostics_highlights_insert_mode_enabled|
39 g:lsp_diagnostics_highlights_delay
40 |g:lsp_diagnostics_highlights_delay|
41 g:lsp_diagnostics_signs_enabled |g:lsp_diagnostics_signs_enabled|
42 g:lsp_diagnostics_signs_insert_mode_enabled
43 |g:lsp_diagnostics_signs_insert_mode_enabled|
44 g:lsp_diagnostics_signs_delay |g:lsp_diagnostics_signs_delay|
45 g:lsp_diagnostics_signs_priority |g:lsp_diagnostics_signs_priority|
46 g:lsp_diagnostics_signs_priority_map
47 |g:lsp_diagnostics_signs_priority_map|
48 g:lsp_diagnostics_virtual_text_enabled
49 |g:lsp_diagnostics_virtual_text_enabled|
50 g:lsp_diagnostics_virtual_text_insert_mode_enabled
51 |g:lsp_diagnostics_virtual_text_insert_mode_enabled|
52 g:lsp_diagnostics_virtual_text_delay
53 |g:lsp_diagnostics_virtual_text_delay|
54 g:lsp_diagnostics_virtual_text_align
55 |g:lsp_diagnostics_virtual_text_align|
56 g:lsp_diagnostics_virtual_text_padding_left
57 |g:lsp_diagnostics_virtual_text_padding_left|
58 g:lsp_diagnostics_virtual_text_wrap
59 |g:lsp_diagnostics_virtual_text_wrap|
60 g:lsp_document_code_action_signs_enabled
61 |g:lsp_document_code_action_signs_enabled|
62 g:lsp_document_code_action_signs_delay
63 |g:lsp_document_code_action_signs_delay|
64 g:lsp_inlay_hints_enabled
65 |g:lsp_inlay_hints_enabled|
66 g:lsp_inlay_hints_delay
67 |g:lsp_inlay_hints_delay|
68 g:lsp_inlay_hints_mode
69 |g:lsp_inlay_hints_mode|
70 g:lsp_tree_incoming_prefix |g:lsp_tree_incoming_prefix|
71 g:lsp_format_sync_timeout |g:lsp_format_sync_timeout|
72 g:lsp_use_event_queue |g:lsp_use_event_queue|
73 g:lsp_max_buffer_size |g:lsp_max_buffer_size|
74 g:lsp_document_highlight_enabled |g:lsp_document_highlight_enabled|
75 g:lsp_document_highlight_delay |g:lsp_document_highlight_delay|
76 g:lsp_get_supported_capabilities |g:lsp_get_supported_capabilities|
77 g:lsp_document_symbol_detail |g:lsp_document_symbol_detail|
78 g:lsp_peek_alignment |g:lsp_peek_alignment|
79 g:lsp_preview_max_width |g:lsp_preview_max_width|
80 g:lsp_preview_max_height |g:lsp_preview_max_height|
81 g:lsp_preview_fixup_conceal |g:lsp_preview_fixup_conceal|
82 g:lsp_float_max_width |g:lsp_float_max_width|
83 g:lsp_signature_help_enabled |g:lsp_signature_help_enabled|
84 g:lsp_fold_enabled |g:lsp_fold_enabled|
85 g:lsp_hover_conceal |g:lsp_hover_conceal|
86 g:lsp_hover_ui |g:lsp_hover_ui|
87 g:lsp_ignorecase |g:lsp_ignorecase|
88 g:lsp_log_file |g:lsp_log_file|
89 g:lsp_log_verbose |g:lsp_log_verbose|
90 g:lsp_semantic_enabled |g:lsp_semantic_enabled|
91 g:lsp_semantic_delay |g:lsp_semantic_delay|
92 g:lsp_text_document_did_save_delay |g:lsp_text_document_did_save_delay|
93 g:lsp_snippet_expand |g:lsp_snippet_expand|
94 g:lsp_completion_resolve_timeout |g:lsp_completion_resolve_timeout|
95 g:lsp_tagfunc_source_methods |g:lsp_tagfunc_source_methods|
96 g:lsp_show_message_request_enabled |g:lsp_show_message_request_enabled|
97 g:lsp_work_done_progress_enabled |g:lsp_work_done_progress_enabled|
98 g:lsp_show_message_log_level |g:lsp_show_message_log_level|
99 g:lsp_untitled_buffer_enabled |g:lsp_untitled_buffer_enabled|
100 Functions |vim-lsp-functions|
101 lsp#enable |lsp#enable()|
102 lsp#disable |lsp#disable()|
103 lsp#register_server |lsp#register_server()|
104 lsp#register_command |lsp#register_command()|
105 lsp#stream |lsp#stream()|
106 lsp#stop_server |lsp#stop_server()|
107 lsp#utils#find_nearest_parent_file_directory()
108 |lsp#utils#find_nearest_parent_file_directory()|
109 lsp#enable_diagnostics_for_buffer() |lsp#enable_diagnostics_for_buffer()|
110 lsp#disable_diagnostics_for_buffer()|lsp#disable_diagnostics_for_buffer()|
111 lsp#get_buffer_diagnostics_counts() |lsp#get_buffer_diagnostics_counts()|
112 lsp#get_buffer_first_error_line() |lsp#get_buffer_first_error_line()|
113 lsp#get_progress() |lsp#get_progress()|
114 lsp#document_hover_preview_winid() |lsp#document_hover_preview_winid()|
115 Commands |vim-lsp-commands|
116 LspAddTreeCallHierarchyIncoming |:LspAddTreeCallHierarchyIncoming|
117 LspAddTreeReferences |:LspAddTreeReferences|
118 LspCallHierarchyIncoming |:LspCallHierarchyIncoming|
119 LspCallHierarchyOutgoing |:LspCallHierarchyOutgoing|
120 LspCodeAction |:LspCodeAction|
121 LspCodeActionSync |:LspCodeActionSync|
122 LspCodeLens |:LspCodeLens|
123 LspDocumentDiagnostics |:LspDocumentDiagnostics|
124 LspDeclaration |:LspDeclaration|
125 LspDefinition |:LspDefinition|
126 LspDocumentFold |:LspDocumentFold|
127 LspDocumentFoldSync |:LspDocumentFoldSync|
128 LspDocumentFormat |:LspDocumentFormat|
129 LspDocumentFormatSync |:LspDocumentFormatSync|
130 LspDocumentRangeFormat |:LspDocumentRangeFormat|
131 LspDocumentRangeFormatSync |:LspDocumentRangeFormatSync|
132 LspDocumentSymbol |:LspDocumentSymbol|
133 LspDocumentSymbolSearch |:LspDocumentSymbolSearch|
135 LspNextDiagnostic |:LspNextDiagnostic|
136 LspNextError |:LspNextError|
137 LspNextReference |:LspNextReference|
138 LspNextWarning |:LspNextWarning|
139 LspPeekDeclaration |:LspPeekDeclaration|
140 LspPeekDefinition |:LspPeekDefinition|
141 LspPeekImplementation |:LspPeekImplementation|
142 LspPeekTypeDefinition |:LspPeekTypeDefinition|
143 LspPreviousDiagnostic |:LspPreviousDiagnostic|
144 LspPreviousError |:LspPreviousError|
145 LspPreviousReference |:LspPreviousReference|
146 LspPreviousWarning |:LspPreviousWarning|
147 LspImplementation |:LspImplementation|
148 LspReferences |:LspReferences|
149 LspRename |:LspRename|
150 LspSemanticHighlightGroups |:LspSemanticHighlightGroups|
151 LspTypeDefinition |:LspTypeDefinition|
152 LspTypeHierarchy |:LspTypeHierarchy|
153 LspWorkspaceSymbol |:LspWorkspaceSymbol|
154 LspWorkspaceSymbolSearch |:LspWorkspaceSymbolSearch|
155 LspStatus |:LspStatus|
156 LspStopServer |:LspStopServer|
157 Autocommands |vim-lsp-autocommands|
158 lsp_setup |lsp_setup|
159 lsp_complete_done |lsp_complete_done|
160 lsp_float_opened |lsp_float_opened|
161 lsp_float_closed |lsp_float_closed|
162 lsp_float_focused |lsp_float_focused|
163 lsp_register_server |lsp_register_server|
164 lsp_unregister_server |lsp_unregister_server|
165 lsp_server_init |lsp_server_init|
166 lsp_server_exit |lsp_server_exit|
167 lsp_buffer_enabled |lsp_buffer_enabled|
168 lsp_diagnostics_updated |lsp_diagnostics_updated|
169 lsp_progress_updated |lsp_progress_updated|
170 Mappings |vim-lsp-mappings|
171 <plug>(lsp-preview-close) |<plug>(lsp-preview-close)|
172 <plug>(lsp-preview-focus) |<plug>(lsp-preview-focus)|
173 Autocomplete |vim-lsp-autocomplete|
174 omnifunc |vim-lsp-omnifunc|
175 asyncomplete.vim |vim-lsp-asyncomplete|
176 Tagfunc |vim-lsp-tagfunc|
177 Snippets |vim-lsp-snippets|
178 Folding |vim-lsp-folding|
179 Semantic highlighting |vim-lsp-semantic|
180 Popup Formatting |vim-lsp-popup-format|
181 Workspace Folders |vim-lsp-workspace-folders|
182 License |vim-lsp-license|
183 Maintainers |vim-lsp-maintainers|
186 ==============================================================================
187 INTRODUCTION *vim-lsp-introduction*
189 Async Language Server Protocol (LSP) for Vim 8 and Neovim.
191 For more information on LSP refer to the official website at
192 https://microsoft.github.io/language-server-protocol/
194 ==============================================================================
195 INSTALL *vim-lsp-install*
197 Install vim-lsp plugin. Below is a sample using plug.vim
199 Plug 'prabirshrestha/vim-lsp'
201 ==============================================================================
202 PERFORMANCE *vim-lsp-performance*
204 While Vim script is very portable it has performance implications. If you would
205 like to improve performance make sure you have vim/neovim with lua support.
206 Currently only diff algorithm uses lua internally if available.
207 Following is the default value used to detect lua.
209 let g:lsp_use_lua = has('nvim-0.4.0') || (has('lua') && has('patch-8.2.0775'))
211 Windows users can download the binaries from the following url and place
212 lua53.dll in the `PATH` or besides `vim.exe` or `gvim.exe` executables.
215 http://downloads.sourceforge.net/luabinaries/lua-5.3.2_Win32_dllw4_lib.zip
218 http://downloads.sourceforge.net/luabinaries/lua-5.3.2_Win64_dllw4_lib.zip
220 If you are using vim set `let g:lsp_use_native_client = 1` and make sure you
221 are running vim 8.2.4780+.
223 Set |g:lsp_semantic_enabled| to 0.
225 Set |g:lsp_format_sync_timeout| to a reasonable value such as `1000`.
227 ==============================================================================
228 LANGUAGE SERVERS *vim-lsp-language-servers*
230 CONFIGURE *vim-lsp-configure*
231 vim-lsp doesn't ship with any language servers. The user is responsible for
232 configuring the language servers correctly.
234 Here is an example of configuring the python language server protocol based
235 on pylsp (https://github.com/python-lsp/python-lsp-server)
237 1. Make sure the language server is available locally in the machine.
238 For python, pip package manager can be used to install the language server.
240 pip install python-lsp-server
242 2. Register the language server in your .vimrc
244 if (executable('pylsp'))
245 au User lsp_setup call lsp#register_server({
247 \ 'cmd': {server_info->['pylsp']},
248 \ 'allowlist': ['python']
252 For more details refer to |lsp#register_server()|.
254 3. Configure your settings for the buffer
255 Use |lsp_buffer_enabled| autocommand to configure the buffer.
257 function! s:on_lsp_buffer_enabled() abort
258 setlocal omnifunc=lsp#complete
259 setlocal signcolumn=yes
260 nmap <buffer> gd <plug>(lsp-definition)
261 nmap <buffer> <f2> <plug>(lsp-rename)
266 autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
269 TCP SERVERS *vim-lsp-tcp*
270 You can use tcp to connect to LSP servers that don't support stdio. Set host
271 and port to tcp. The Godot game engine uses 6008 as its LSP port and godot
272 ftplugins define gdscript or gdscript3 filetype: >
275 \ call lsp#register_server({
277 \ 'tcp': "localhost:6008",
278 \ 'allowlist': ['gdscript3', 'gdscript']
281 VIM-LSP-SETTINGS *vim-lsp-settings_plugin*
282 Refer to [vim-lsp-settings](https://github.com/mattn/vim-lsp-settings) on how
283 to automatically register various language servers.
285 Plug 'prabirshrestha/vim-lsp'
286 Plug 'mattn/vim-lsp-settings'
288 HEALTH CHECK *vim-lsp-healthcheck*
289 vim-lsp supports the |:CheckHealth| command which can be useful when debugging
290 lsp configuration issues.
292 This command is implemented in vim with the
293 [vim-healthcheck](https://github.com/rhysd/vim-healthcheck) plugin.
295 WIKI *vim-lsp-configure-wiki*
296 For documentation on how to configure other language servers refer
297 to https://github.com/prabirshrestha/vim-lsp/wiki/Servers
299 ==============================================================================
300 Options *vim-lsp-options*
302 g:lsp_auto_enable *g:lsp_auto_enable*
306 Auto enable vim-lsp plugin during startup. Set to `0` to disable auto
307 enabling vim-lsp during startup.
310 let g:lsp_auto_enable = 1
311 let g:lsp_auto_enable = 0
313 g:lsp_use_native_client *g:lsp_use_native_client*
317 Enable native lsp client support for vim 8.2.4780+. No impact for neovim.
318 TCP language servers are not supported and should be set to 0 if one is
322 let g:lsp_use_native_client = 1
323 let g:lsp_use_native_client = 0
325 g:lsp_preview_keep_focus *g:lsp_preview_keep_focus*
329 Indicates whether to keep the focus on current window or move the focus
330 to the |preview-window| when a |preview-window| is opened by vim-lsp.
331 Certain commands such as |:LspHover| opens the result in a
335 " Keep the focus in current window
336 let g:lsp_preview_keep_focus = 1
338 " Do not keep the focus in current window.
339 " Move the focus to |preview-window|.
340 let g:lsp_preview_keep_focus = 0
342 * |preview-window| can be closed using the default vim mapping - `<c-w><c-z>`.
343 * |preview-window| can be also automatically closed after completion with
344 the following auto command: >
345 autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif
346 < * |preview-window| can be suppressed with: >
347 set completeopt-=preview
349 g:lsp_preview_float *g:lsp_preview_float*
353 If set and nvim_win_open() or popup_create is available, hover information
354 are shown in a floating window as |preview-window| at the cursor position.
355 The |preview-window| is closed automatically on cursor moves, unless it is
356 focused. While focused it may be closed with <C-c>.
358 This feature requires neovim 0.4.0 (current master) or
359 Vim8.1 with has('patch-8.1.1517').
362 " Opens preview windows as floating
363 let g:lsp_preview_float = 1
365 " Opens preview windows as normal windows
366 let g:lsp_preview_float = 0
368 After opening an autocmd User event lsp_float_opened is issued, as well as
369 and lsp_float_closed upon closing. This can be used to alter the preview
370 window (using |lsp#document_hover_preview_winid()| to get the window id),
371 setup custom bindings while a preview is open, or change the highlighting
374 Example of custom keybindings: >
375 " Close preview window with <C-c>
376 autocmd User lsp_float_opened nmap <buffer> <silent> <C-c>
377 \ <Plug>(lsp-preview-close)
378 autocmd User lsp_float_closed nunmap <buffer> <C-c>
381 Example of customising the highlighting: >
382 highlight PopupWindow ctermbg=lightblue guibg=lightblue
384 augroup lsp_float_colours
387 autocmd User lsp_float_opened
388 \ call setwinvar(lsp#document_hover_preview_winid(),
389 \ '&wincolor', 'PopupWindow')
391 autocmd User lsp_float_opened
392 \ call nvim_win_set_option(
393 \ lsp#document_hover_preview_winid(),
394 \ 'winhighlight', 'Normal:PopupWindow')
399 g:lsp_preview_autoclose *g:lsp_preview_autoclose*
403 Indicates if an opened floating preview shall be automatically closed upon
404 movement of the cursor. If set to 1, the window will close automatically
405 if the cursor is moved and the preview is not focused. If set to 0, it
406 will remain open until explicitly closed (e.g. with
407 |<plug>(lsp-preview-close)|, or <ESC> when focused).
410 " Preview closes on cursor move
411 let g:lsp_preview_autoclose = 1
413 " Preview remains open and waits for an explicit call
414 let g:lsp_preview_autoclose = 0
416 g:lsp_preview_doubletap *g:lsp_preview_doubletap*
418 Default: `[function('lsp#ui#vim#output#focuspreview')]`
420 When preview is called twice with the same data while the preview is still
421 open, the function in `lsp_preview_doubletap` is called instead. To
422 disable this and just "refresh" the preview, set to ´0´.
425 " Focus preview on repeated preview (does not work for vim8.1 popups)
426 let g:lsp_preview_doubletap = [function('lsp#ui#vim#output#focuspreview')]
428 " Closes the preview window on the second call to preview
429 let g:lsp_preview_doubletap = [function('lsp#ui#vim#output#closepreview')]
431 " Disables double tap feature; refreshes the preview on consecutive taps
432 let g:lsp_preview_doubletap = 0
434 g:lsp_insert_text_enabled *g:lsp_insert_text_enabled*
438 Enable support for completion insertText property. Set to `0` to disable
442 let g:lsp_insert_text_enabled = 1
443 let g:lsp_insert_text_enabled = 0
445 g:lsp_text_edit_enabled *g:lsp_text_edit_enabled*
449 Enable support for completion textEdit property. Set to `0` to disable
453 let g:lsp_text_edit_enabled = 1
454 let g:lsp_text_edit_enabled = 0
456 g:lsp_completion_documentation_enabled *g:lsp_completion_documentation_enabled*
460 Enables floating window documentation for complete items.
463 let g:lsp_completion_documentation_enabled = 1
464 let g:lsp_completion_documentation_enabled = 0
466 g:lsp_completion_documentation_delay *g:lsp_completion_documentation_delay*
470 Time in milliseconds to delay the completion documentation popup. Might
471 help with performance. Set this to `0` to disable debouncing.
474 let g:lsp_completion_documentation_delay = 120
475 let g:lsp_completion_documentation_delay = 0
477 g:lsp_diagnostics_enabled *g:lsp_diagnostics_enabled*
481 Enable support for document diagnostics like warnings and error messages.
482 enabling vim-lsp during startup.
483 Refer to |g:lsp_diagnostics_signs_enabled| to enable signs column.
484 Refer to |g:lsp_diagnostics_virtual_text_enabled| to enable virtual text.
487 let g:lsp_diagnostics_enabled = 1
488 let g:lsp_diagnostics_enabled = 0
490 g:lsp_diagnostics_echo_cursor *g:lsp_diagnostics_echo_cursor*
494 Enables echo of diagnostic error for the current line to status. Requires
495 |g:lsp_diagnostics_enabled| set to 1.
498 let g:lsp_diagnostics_echo_cursor = 1
499 let g:lsp_diagnostics_echo_cursor = 0
501 g:lsp_diagnostics_echo_delay *g:lsp_diagnostics_echo_delay*
505 Delay milliseconds to echo diagnostic error for the current line to status.
506 Requires |g:lsp_diagnostics_enabled| and |g:lsp_diagnostics_echo_cursor| set
510 let g:lsp_diagnostics_echo_delay = 200
511 let g:lsp_diagnostics_echo_delay = 1000
513 g:lsp_diagnostics_float_cursor *g:lsp_diagnostics_float_cursor*
517 Enables a floating window of diagnostic error for the current line to
518 status. Requires nvim_win_open() or popup_create is available, and
519 |g:lsp_diagnostics_enabled| set to 1.
522 let g:lsp_diagnostics_float_cursor = 1
523 let g:lsp_diagnostics_float_cursor = 0
525 g:lsp_diagnostics_float_delay *g:lsp_diagnostics_float_delay*
529 Delay milliseconds to show diagnostic error for the current line to status
530 in a float window. Requires Enables float of diagnostic error for the
531 current line to status. Requires |g:lsp_diagnostics_enabled| and
532 |g:lsp_diagnostics_float_cursor| set to 1.
535 let g:lsp_diagnostics_float_delay = 200
536 let g:lsp_diagnostics_float_delay = 1000
538 g:lsp_diagnostics_float_insert_mode_enabled
539 *g:lsp_diagnostics_float_insert_mode_enabled*
543 Indicates whether to enable float of diagnostic error for the current line
544 to status when in |insertmode|. Requires |g:lsp_diagnostics_enabled| and
545 |g:lsp_diagnostics_float_cursor| set to 1.
548 let g:lsp_diagnostics_float_insert_mode_enabled = 0
550 g:lsp_format_sync_timeout *g:lsp_format_sync_timeout*
554 Timeout milliseconds to abort `:LspDocumentFormatSync` or
555 `:LspDocumentRangeFormatSync`. Set to `-1` to disable timeout. Using
556 `BufWritePre` to execute sync commands may cause vim to hang when using
557 some language servers as starting the language server may be slow. Set the
558 timeout value to cancel sync format.
561 let g:lsp_format_sync_timeout = -1
562 let g:lsp_format_sync_timeout = 1000
564 g:lsp_diagnostics_highlights_enabled *g:lsp_diagnostics_highlights_enabled*
566 Default: `1` for neovim 0.3+ and vim with patch-8.1.1035
568 Enables highlighting of diagnostics. Requires NeoVim with version 0.3 or
569 Vim 8.1.1035 or newer.
572 let g:lsp_diagnostics_highlights_enabled = 1
573 let g:lsp_diagnostics_highlights_enabled = 0
575 To change the style of the highlighting, you can set or link
576 `LspErrorHighlight`, `LspWarningHighlight`, `LspInformationHighlight` and
577 `LspHintHighlight` highlight groups.
580 highlight link LspErrorHighlight Error
582 g:lsp_diagnostics_highlights_insert_mode_enabled
583 *g:lsp_diagnostics_highlights_insert_mode_enabled*
587 Indicates whether to enable diagnostics highlighting when in |insertmode|.
588 Requires |g:lsp_diagnostics_highlights_enabled|.
591 let g:lsp_diagnostics_highlights_insert_mode_enabled = 1
592 let g:lsp_diagnostics_highlights_insert_mode_enabled = 0
594 g:lsp_diagnostics_highlights_delay *g:lsp_diagnostics_highlights_delay*
598 Delay milliseconds to update diagnostics highlights. Requires
599 |g:lsp_diagnostics_highlights_enabled|.
602 let g:lsp_diagnostics_highlights_delay = 200
603 let g:lsp_diagnostics_highlights_delay = 1000
605 g:lsp_diagnostics_signs_enabled
606 *g:lsp_diagnostics_signs_enabled*
608 Default: `1` for vim/neovim with patch 8.1.0772
610 Enables signs for diagnostics. Requires NeoVim with |sign_define| or Vim
611 with |sign_define| and patch 8.1.0772 or newer and
612 |g:lsp_diagnostics_enabled| set to `1`.
615 let g:lsp_diagnostics_signs_enabled = 1
616 let g:lsp_diagnostics_signs_enabled = 0
618 Four groups of signs are defined and used:
619 `LspError`, `LspWarning`, `LspInformation`, `LspHint`.
621 It is possible to set custom text or icon that will be used for each sign
622 (note that icons are only available in GUI).
624 `LspError` defaults to `E>`.
625 `LspHint` defaults to `H>`.
626 `LspInformation` defaults to `I>`.
627 `LspWarning` defaults to `W>`.
629 To do this, set some of the following globals:
630 `g:lsp_diagnostics_signs_error`, `g:lsp_diagnostics_signs_warning`,
631 `g:lsp_diagnostics_signs_information`, `g:lsp_diagnostics_signs_hint`.
633 They should be set to a dict, that contains either text that will be used
634 as sign in terminal, or icon that will be used for GUI, or both.
637 let g:lsp_diagnostics_signs_error = {'text': '✗'}
638 let g:lsp_diagnostics_signs_warning = {'text': '‼', 'icon': '/path/to/some/icon'} " icons require GUI
639 let g:lsp_diagnostics_signs_hint = {'icon': '/path/to/some/other/icon'} " icons require GUI
641 g:lsp_diagnostics_signs_insert_mode_enabled
642 *g:lsp_diagnostics_signs_insert_mode_enabled*
646 Indicates whether to enable diagnostics signs column when in |insertmode|.
647 Requires |g:lsp_diagnostics_signs_enabled|.
650 let g:lsp_diagnostics_signs_insert_mode_enabled = 1
651 let g:lsp_diagnostics_signs_insert_mode_enabled = 0
653 g:lsp_diagnostics_signs_delay *g:lsp_diagnostics_signs_delay*
657 Delay milliseconds to update diagnostics signs column. Requires
658 |g:lsp_diagnostics_signs_enabled|.
661 let g:lsp_diagnostics_signs_delay = 200
662 let g:lsp_diagnostics_signs_delay = 1000
664 g:lsp_diagnostics_signs_priority *g:lsp_diagnostics_signs_priority*
668 Configures the |sign-priority| for placed signs. Signs placed by other
669 plugins have a priority of 10 by default. Requires
670 |g:lsp_diagnostics_signs_enabled| set to 1.
673 let g:lsp_diagnostics_signs_priority = 11
674 let g:lsp_diagnostics_signs_priority = 9
676 g:lsp_diagnostics_signs_priority_map *g:lsp_diagnostics_signs_priority_map*
680 Overrides |g:lsp_diagnostics_signs_priority| per severity level or per server
681 name and severity level. Requires |g:lsp_diagnostics_signs_enabled| set to 1.
684 let g:lsp_diagnostics_signs_priority_map = {
687 \'clangd_LspWarning': 11,
688 \'clangd_LspInformation': 11
691 g:lsp_diagnostics_virtual_text_enabled
692 *g:lsp_diagnostics_virtual_text_enabled*
694 Default: `1` for neovim 0.3+
696 Enables virtual text to be shown next to diagnostic errors. Requires
697 NeoVim with version 0.3 or newer or Vim with |virtual-text| and
698 patch 9.0.0178, and |g:lsp_diagnostics_enabled| set to `1`.
699 Virtual text uses the same highlight groups used for signs (eg LspErrorText),
700 but can be uniquely defined if you want to have different highlight groups
701 for signs and virtual text. To set unique virtual text highlighting, you
702 can set or link `LspErrorVirtualText`, `LspWarningVirtualText`,
703 `LspInformationVirtualText` and `LspHintVirtualText` highlight groups.
706 let g:lsp_diagnostics_virtual_text_enabled = 1
707 let g:lsp_diagnostics_virtual_text_enabled = 0
709 g:lsp_diagnostics_virtual_text_insert_mode_enabled
710 *g:lsp_diagnostics_virtual_text_insert_mode_enabled*
714 Indicates whether to enable diagnostics virtual text when in |insertmode|.
715 Requires |g:lsp_diagnostics_virtual_text_enabled|.
718 let g:lsp_diagnostics_virtual_text_insert_mode_enabled = 1
719 let g:lsp_diagnostics_virtual_text_insert_mode_enabled = 0
721 g:lsp_diagnostics_virtual_text_delay *g:lsp_diagnostics_virtual_text_delay*
725 Delay milliseconds to update diagnostics virtual text. Requires
726 |g:lsp_diagnostics_virtual_text_enabled|.
729 let g:lsp_diagnostics_virtual_text_delay = 200
730 let g:lsp_diagnostics_virtual_text_delay = 1000
732 g:lsp_diagnostics_virtual_text_prefix *g:lsp_diagnostics_virtual_text_prefix*
736 Adds the prefix to the diagnostics to be shown as virtual text. Requires
737 |g:lsp_diagnostics_virtual_text_enabled|.
740 let g:lsp_diagnostics_virtual_text_prefix = "> "
741 let g:lsp_diagnostics_virtual_text_prefix = " ‣ "
743 g:lsp_diagnostics_virtual_text_align *g:lsp_diagnostics_virtual_text_align*
747 Determines the align of the diagnostics virtual text. Requires
748 |g:lsp_diagnostics_virtual_text_enabled|.
752 after after the end of the line
753 right right aligned in the window (unless the text wraps to the next
755 below in the next screen line
756 above just above the line
758 Only one "right" property can fit in each line, if there are two or more
759 these will go in a separate line (still right aligned).
761 This value is passed as the "text_align" property in a |prop_add()| call.
764 let g:lsp_diagnostics_virtual_text_align = "right"
766 g:lsp_diagnostics_virtual_text_padding_left
767 *g:lsp_diagnostics_virtual_text_padding_left*
771 Determines the left padding of the diagnostics virtual text. Requires
772 |g:lsp_diagnostics_virtual_text_enabled|.
775 let g:lsp_diagnostics_virtual_text_padding_left = 2
777 g:lsp_diagnostics_virtual_text_wrap *g:lsp_diagnostics_virtual_text_wrap*
781 Determines whether or not to wrap the diagnostics virtual text. Possible
782 values are one of `'wrap'`, `'truncate'`. Requires
783 |g:lsp_diagnostics_virtual_text_enabled|.
786 let g:lsp_diagnostics_virtual_text_wrap = "truncate"
788 g:lsp_document_code_action_signs_enabled
789 *g:lsp_document_code_action_signs_enabled*
793 Enables signs for code actions. Requires NeoVim with |sign_define| or Vim
794 with |sign_define| and patch 8.1.0772 or newer.
797 let g:lsp_document_code_action_signs_enabled = 1
798 let g:lsp_document_code_action_signs_enabled = 0
800 `LspCodeActionText` sign is defined and used.
802 It is possible to set custom text or icon that will be used for sign
803 (note that icons are only available in GUI).
805 `LspCodeActionText` defaults to `A>`.
807 To do this, set the following globals:
808 `g:lsp_document_code_action_signs_hint`.
809 They should be set to a dict, that contains either text that will be used
810 as sign in terminal, or icon that will be used for GUI, or both.
813 let g:lsp_document_code_action_signs_hint = {'text': 'A>'}
814 let g:lsp_document_code_action_signs_hint = {'text': '‼', 'icon': '/path/to/some/icon'} " icons require GUI
815 let g:lsp_document_code_action_signs_hint = {'icon': '/path/to/some/other/icon'} " icons require GUI
817 g:lsp_document_code_action_signs_delay
818 *g:lsp_document_code_action_signs_delay*
822 Delay milliseconds to update code action signs. Requires
823 |g:lsp_document_code_action_signs_enabled|.
826 let g:lsp_document_code_action_signs_delay = 200
827 let g:lsp_document_code_action_signs_delay = 1000
829 g:lsp_inlay_hints_enabled
830 *g:lsp_inlay_hints_enabled*
834 Enables inlay-hints. Requires Vim9 with |virtual-text|.
835 patch 9.0.0167 or newer.
838 let g:lsp_inlay_hints_enabled = 1
839 let g:lsp_inlay_hints_enabled = 0
841 To change the style of the inlay-hints, you can set or link the
842 `lspInlayHintsType` and `lspInlayHintsParameter` highlight group.
845 highlight lspInlayHintsType ctermfg=red guifg=red
846 \ ctermbg=green guibg=green
847 highlight lspInlayHintsParameter ctermfg=red guifg=red
848 \ ctermbg=green guibg=green
850 g:lsp_inlay_hints_delay
851 *g:lsp_inlay_hints_delay*
855 Delay milliseconds to update inlay-hints. Requires
856 |g:lsp_inlay_hints_enabled|.
859 let g:lsp_inlay_hints_delay = 200
860 let g:lsp_inlay_hints_delay = 1000
862 g:lsp_inlay_hints_mode
863 *g:lsp_inlay_hints_mode*
867 This mode currently only include "curline" and "!curline".
870 let g:lsp_inlay_hints_mode = {
871 \ 'normal': ['curline'],
874 "curline" show hint only for current line. "!curline" show hints except
875 current line. Default show all hints.
877 g:lsp_tree_incoming_prefix *g:lsp_tree_incoming_prefix*
881 Specifies the prefix of items added by following commands.
882 * |LspAddTreeCallHierarchyIncoming|
883 * |LspAddTreeReferences|
886 let g:lsp_tree_incoming_prefix = "← "
887 let g:lsp_tree_incoming_prefix = "⬅️ "
889 g:lsp_use_event_queue *g:lsp_use_event_queue*
891 Default: `1` for neovim or vim with patch-8.1.0889
893 Enable event queue which improves performance by reducing the
894 communication between client and server.
897 let g:lsp_use_event_queue = 1
898 let g:lsp_use_event_queue = 0
900 g:lsp_max_buffer_size *g:lsp_max_buffer_size*
904 To improve performance, if a buffer is larger than
905 `g:lsp_max_buffer_size` (measured in bytes), the following features
907 * Semantic highlighting
909 This functionality can be disabled by setting `g:lsp_max_buffer_size`
913 let g:lsp_max_buffer_size = 10000000
914 let g:lsp_max_buffer_size = -1
916 g:lsp_document_highlight_enabled *g:lsp_document_highlight_enabled*
918 Default: `1` for neovim or vim with patch-8.1.1035
920 Enables highlighting of the references to the symbol under the cursor.
921 Requires NeoVim with version 0.3 or Vim 8.1.1035 or newer.
924 let g:lsp_document_highlight_enabled = 1
925 let g:lsp_document_highlight_enabled = 0
928 To change the style of the highlighting, you can set or link the
929 `lspReference` highlight group.
932 highlight lspReference ctermfg=red guifg=red ctermbg=green guibg=green
934 g:lsp_document_highlight_delay *g:lsp_document_highlight_delay*
938 Delay milliseconds to highlight references. Requires
939 |g:lsp_document_highlight_enabled| set to 1.
942 let g:lsp_document_highlight_delay = 200
943 let g:lsp_document_highlight_delay = 1000
945 g:lsp_get_supported_capabilities *g:lsp_get_supported_capabilities*
947 Default: `[function('lsp#default_get_supported_capabilities')]`
949 A |List| containing one element of type |Funcref|. This element is a
950 reference to the function that vim-lsp should use to obtain the supported
951 LSP capabilities. Changing this variable allows customizing which
952 capabilities vim-lsp sends to a language server.
954 Note: You can obtain the default supported capabilities of vim-lsp by
955 calling `lsp#default_get_supported_capabilities` from within your
958 g:lsp_document_symbol_detail *g:lsp_document_symbol_detail*
962 Determines whether document symbol shows details or not. Set to `1` to
965 Note: showing details needs to turn on setting below: >
968 \ 'documentSymbol': {
969 \ 'hierarchicalDocumentSymbolSupport': v:true,
974 g:lsp_peek_alignment *g:lsp_peek_alignment*
978 Determines how to align the location of interest for e.g.
979 |:LspPeekDefinition|. Three values are possible: `"top"`, `"center"` and
980 `"bottom"`, which place the location of interest at the first, middle and
981 last lines of the preview/popup/floating window, respectively.
983 g:lsp_preview_max_width *g:lsp_preview_max_width*
987 If positive, determines the maximum width of the preview window in
988 characters. Lines longer than `g:lsp_preview_max_width` will be wrapped to
989 fit in the preview window. Use a value of `-1` to disable setting a
992 g:lsp_preview_max_height *g:lsp_preview_max_height*
996 If positive, determines the maximum height of the preview window in
997 characters. Use a value of `-1` to disable setting a maximum height.
999 g:lsp_preview_fixup_conceal *g:lsp_preview_fixup_conceal*
1003 If negative, all markdown documents are not converted as compact format.
1004 That's useful in vim. vim's popup doesn't shrink correctly if the
1005 buffer content uses conceals.
1007 g:lsp_float_max_width *g:lsp_float_max_width*
1011 If positive, determines the maximum width of the float windows in
1012 characters. Lines longer than `g:lsp_float_max_width` will be wrapped to fit
1013 in the float window.
1014 If set to 0, float windows can stretch to the width of the screen.
1015 Otherwise, the maximum width of the floating windows is set to 40% of the
1018 g:lsp_signature_help_enabled *g:lsp_signature_help_enabled*
1022 Enable support for signature help. Set to `0` to disable.
1025 let g:lsp_signature_help_enabled = 1
1026 let g:lsp_signature_help_enabled = 0
1028 g:lsp_signature_help_delay *g:lsp_signature_help_delay*
1032 The waiting time in milliseconds before sending textDocument/signatureHelp
1036 let g:lsp_signature_help_delay = 100
1037 let g:lsp_signature_help_delay = 500
1039 g:lsp_show_workspace_edits *g:lsp_show_workspace_edits*
1043 Enable showing changes made in a workspace edit in the |location-list|.
1044 Set to `0` to disable.
1047 let g:lsp_show_workspace_edits = 1
1048 let g:lsp_show_workspace_edits = 0
1050 g:lsp_fold_enabled *g:lsp_fold_enabled*
1054 Determines whether or not folding is enabled globally. Set to `0` to
1055 disable sending requests.
1057 g:lsp_hover_conceal *g:lsp_hover_conceal*
1061 If `true` (`1`), 'conceallevel' is set to `2` for hover windows. This
1062 means that, for example, asterisks in markdown hovers are hidden, but the
1063 text is still displayed bold. You may want to disable this if the filetype
1064 of the popup has custom conceals which you don't want to use, or if
1065 you're using Vim in a terminal.
1067 To override this setting per server, see
1068 |vim-lsp-server_info-hover_conceal|.
1070 g:lsp_hover_ui *g:lsp_hover_ui*
1074 Controls default UI behavior for |LspHover|.
1075 If empty string, defaults to `float` if popup is supported in vim or
1076 floating window is supported in neovim else uses |preview-window|.
1079 let g:lsp_hover_ui = ''
1080 let g:lsp_hover_ui = 'float'
1081 let g:lsp_hover_ui = 'preview'
1083 g:lsp_ignorecase *g:lsp_ignorecase*
1085 Default: the value of 'ignorecase'
1087 Determines whether or not case should be ignored when filtering or sorting
1089 See |vim-lsp-completion-filter| or |vim-lsp-completion-sort|.
1090 By default, the value of 'ignorecase' is used.
1092 g:lsp_log_file *g:lsp_log_file*
1096 Determines whether or not logging should be written to a file.
1097 To disable log use empty string.
1100 let g:lsp_log_file = ''
1101 let g:lsp_log_file = expand('~/vim-lsp.log')
1103 g:lsp_log_verbose *g:lsp_log_verbose*
1107 Determines whether or not verbose logging should be enabled. This usually
1108 includes logging the entire request and response from the LSP servers and
1109 clients which can have significant performance impact. Requires
1110 |g:lsp_log_file| to be set else there is no impact on enabling or
1111 disabling this flag.
1114 let g:lsp_log_verbose = 1
1115 let g:lsp_log_verbose = 0
1117 g:lsp_semantic_enabled *g:lsp_semantic_enabled*
1121 Determines whether or not semantic highlighting is enabled globally. Set
1122 to `1` to enable sending requests.
1124 g:lsp_semantic_delay *g:lsp_semantic_delay*
1128 Modifications which occur within |g:lsp_semantic_delay| of one another are
1129 lumped into a single `semanticTokens` request. Sets the maximum rate at
1130 which the semantic highlighting can update.
1132 g:lsp_text_document_did_save_delay *g:lsp_text_document_did_save_delay*
1136 The waiting time in milliseconds before sending textDocument/didSave to
1137 LSP servers, -1 by default means no delay. If >= 0, will delay using
1138 |timer_start()| with {time} is the number.
1140 g:lsp_snippet_expand *g:lsp_snippet_expand*
1143 The integration point to other snippet plugin.
1144 vim-lsp may invoke the first item of this value when it needs snippet
1147 g:lsp_completion_resolve_timeout *g:lsp_completion_resolve_timeout*
1151 The `completionItem/resolve` request's timeout value.
1152 If your vim freeze at `CompleteDone`, you can set this value to 0.
1154 g:lsp_tagfunc_source_methods *g:lsp_tagfunc_source_methods*
1156 Default: `['definition', 'declaration', 'implementation', 'typeDefinition']`
1158 The LSP methods to call to get symbols for tag lookup. See
1161 g:lsp_show_message_request_enabled *g:lsp_show_message_request_enabled*
1165 Determines whether or not `window/showMessageRequest` should show message to
1166 the user or if it should be ignored. Set to `1` to enable.
1168 g:lsp_work_done_progress_enabled *g:lsp_work_done_progress_enabled*
1172 Determines whether or not to ask the server to send `$/progress`
1173 notifications. This can be intercepted by listening to |lsp#stream()|.
1174 Set to `1` to enable.
1176 g:lsp_show_message_log_level *g:lsp_show_message_log_level*
1178 Default: `'warning'`
1180 Determines log level of messages sent from LSP servers. Possible values
1181 are one of `'none'`, `'error'`, `'warning'`, `'info'`, `'log'`. Messages
1182 are filtered by the value set to this variable. For example, when
1183 `'warning'` is set, `'error'` level and `'warning'` level messages are
1184 shown but `'info'` level and `'log'` level messages are not shown. Setting
1185 `'none'` disables to show messages completely.
1187 g:lsp_untitled_buffer_enabled *g:lsp_untitled_buffer_enabled*
1191 Determines whether or not vim-lsp plugin is enabled for untitled buffer.
1192 Set to `0` to disable for untitled buffer.
1194 ==============================================================================
1195 FUNCTIONS *vim-lsp-functions*
1197 lsp#enable() *lsp#enable()*
1199 Enables vim-lsp plugin.
1204 lsp#disable() *lsp#disable()*
1206 Disables vim-lsp plugin.
1211 lsp#register_server({server-info}) *lsp#register_server()*
1213 Used to register the language server with vim-lsp. This method takes
1214 one parameter which is a vim |dict| and is referred to as |vim-lsp-server_info|
1217 if (executable('pylsp'))
1218 au User lsp_setup call lsp#register_server({
1219 \ 'name': 'name-of-server',
1220 \ 'cmd': {server_info->['server-exectuable']},
1221 \ 'allowlist': ['filetype to allowlist'],
1222 \ 'blocklist': ['filetype to blocklist'],
1224 \ 'workspace_config': {'param': {'enabled': v:true}},
1225 \ 'languageId': {server_info->'python'},
1230 * checking for executable is optional but can be used to avoid
1231 unnecessary server registration.
1232 * au User lsp_setup is optional and used to delay registering the
1233 language server after .vimrc has been loaded. It is recommended
1234 to use it if possible.
1236 server_info *vim-lsp-server_info*
1237 The vim |dict| containing information about the server.
1240 'name': 'name of the server',
1241 'cmd': {server_info->['server_executable']},
1242 'allowlist': ['filetype'],
1243 'blocklist': ['filetype'],
1245 'workspace_config': {},
1246 'languageId': {server_info->'filetype'},
1251 Name of the language server. Needs to be unique.
1255 Function or array which represents command line to start the language
1258 When function, it takes |vim-lsp-server_info| as parameter and returns the
1259 language server executable to run along with the appropriate arguments
1260 when the appropriate filetype is loaded. This function will only be
1261 called when the server has not started.
1262 Return empty array to ignore starting the server.
1264 When array, the first element is the language server executable and
1265 the rest are the appropriate arguments. It is useful when the command line
1266 can be determined statically and |vim-lsp-server_info| is not necessary.
1271 Function can be complex based on custom requirements.
1273 - Use binary from local node_modules folder instead of a global
1274 node_modules folder.
1275 - Use different executable based on custom config.
1276 - Return empty array to ignore starting server due to missing
1277 config value required by the server (ex: missing package.json)
1278 - Instead of checking for server executable before calling
1279 register_server it can also be checked here.
1281 Cross-platform compatibility notes:
1282 It is recommended to use &shell with &shellcmdflag when running script
1283 files that can be executed specially on windows where *.bat and *.cmd
1284 files cannot be started without running the shell first. This is common
1285 for executable installed by npm for nodejs.
1288 'cmd': {server_info->
1289 \ [&shell, &shellcmdflag, 'typescript-language-server --stdio']}
1293 String array of filetypes to run the language server.
1296 'allowlist': ['javascript', 'typescript']
1298 '*' is treated as any filetype.
1302 String array of filetypes not to run the language server.
1305 'blocklist': ['javascript', 'typescript']
1307 '*' is treated as any filetype.
1309 allowlist and blocklist can be used together. The following example
1310 says to run the language server for all filetypes except javascript
1311 and typescript. blocklist always takes higher priority over allowlist.
1314 'blocklist': ['javascript', 'typescript']
1318 vim |dict| or a function returning a vim |dict|
1319 Used to pass workspace configuration to the server after
1320 initialization. Configuration settings are language-server specific.
1323 'workspace_config': {'pylsp': {'plugins': \
1324 {'pydocstyle': {'enabled': v:true}}}}
1327 optional function returning |string|
1328 By default the languageId is the current filetype. If you're using a sub
1329 filetype like 'ios.swift' your language server may not return anything
1330 because it does not know this language.
1331 In this case you might want to overwrite the languageId with this key.
1334 'languageId': {server_info->'typescript'}
1338 Used to pass additional custom config.
1341 'config': { 'prefer_local': 1 }
1343 This can then be used by cmd function.
1345 function! s:myserver_cmd(server_info) abort
1346 let l:config = get(a:server_info, 'config', {})
1347 let l:prefer_local = get(l:config, 'prefer_local', 1)
1349 return ['./local-executable']
1351 return ['/bin/global-exectuable']
1355 'cmd': function('s:myserver_cmd')
1357 Using the `config` key, you can also specify a custom 'typed word
1358 pattern', or a custom filter for completion items, see
1359 |vim-lsp-completion-filter|.
1361 The following per-server configuration options are supported by vim-lsp.
1363 * hover_conceal *vim-lsp-server_info-hover_conceal*
1365 Default: |g:lsp_hover_conceal|
1367 This takes precedence over the value of |g:lsp_hover_conceal|, to
1368 allow overriding this setting per server.
1371 'config': { 'hover_conceal': 1 }
1377 This allows overriding the default text mappings for symbol kinds
1378 (e.g., "module", "method") per server. Useful for abbreviating or
1379 removing the kind text.
1382 'config': { 'symbol_kinds': {'26': 'type' } }
1384 * completion_item_kinds
1388 This allows overriding the default text mappings for completion
1389 item kinds (e.g., "module", "method") per server. Useful for
1390 abbreviating or removing the kind text.
1393 'config': { 'completion_item_kinds': {'26': 'type' } }
1399 This allows disablingdiagnostics per server. Useful when dealing
1400 with multiple servers (One for diagnostic only)
1403 'config': { 'diagnostics': v:false }
1407 Used to pass environment variables to the cmd.
1409 'env': { 'GOFLAGS': '-tags=wireinject' }
1412 refresh_pattern *vim-lsp-refresh_pattern*
1413 Type: |String| (|pattern|)
1416 Vim-lsp will automatically detect start column of completion so far when
1417 invoking completion. It does this by checking the textEdit's range of each
1420 You can use a |regexp| to determine what you want to start completion with
1421 matched text so far. The pattern is matched against the current line, from
1422 column 0 up until the cursor's position. Thus, |/$| means "current cursor
1423 position" in this context.
1426 'config': { 'refresh_pattern': '\k*$' }
1428 This uses all characters in `'iskeyword'` in front of the cursor as typed
1431 This key is also used to align the completion menu: the completion menu is
1432 placed so its left border is at the column that matches the start of the
1435 filter *vim-lsp-completion-filter*
1437 You can filter the completion items returned from the server by specifying a
1438 completion filter using the `filter` key in the server info's `config` |dict|.
1439 The value of the `filter` key is itself a |dict| containing at least a key
1440 `name`, which specifies which filter to use.
1442 The case (in)sensitivity of the matching is determined by |g:lsp_ignorecase|.
1445 'config': { 'filter': { 'name': 'none' } }
1447 Available filters are:
1449 Do not filter completion items, use all items returned from the
1453 Only allow completion items that are a prefix of the already typed
1457 Only allow completion items that contain the already typed word.
1459 Note: After triggering completion with |i_CTRL-X_CTRL-O|, further filtering is
1460 only possible by adding to the already typed prefix (even if you're using the
1461 `contains` filter). If you'd like to retrigger the filtering, you will have to
1462 press CTRL-X CTRL-O again.
1464 sort *vim-lsp-completion-sort*
1466 You can sort the completion items returned from the server by using the `sort`
1467 key in the server info's `config` |dict|.
1468 The value of the `sort` key is itself a |dict| containing at least a key
1469 `max`, which specifies max number of completion items count before giving up
1470 sorting for performance reason.
1472 The case (in)sensitivity of the matching is determined by |g:lsp_ignorecase|.
1475 'config': { 'sort': { 'max': 100 } }
1477 lsp#register_command({command-name}, {callback}) *lsp#register_command()*
1479 Some language server expects handling custom command in the client.
1480 You can use this function to add custom command handler.
1482 {command-name} is unique id to specify command.
1483 {callback} is funcref that accepts below argument.
1493 For example, the rust-analyzer expects the client handles some custom command
1496 function! s:rust_analyzer_apply_source_change(context)
1497 let l:command = get(a:context, 'command', {})
1499 let l:workspace_edit = get(l:command['arguments'][0], 'workspaceEdit', {})
1500 if !empty(l:workspace_edit)
1501 call lsp#utils#workspace_edit#apply_workspace_edit(l:workspace_edit)
1504 let l:cursor_position = get(l:command['arguments'][0], 'cursorPosition', {})
1505 if !empty(l:cursor_position)
1506 call cursor(lsp#utils#position#lsp_to_vim('%', l:cursor_position))
1509 call lsp#register_command('rust-analyzer.applySourceChange', function('s:rust_analyzer_apply_source_change'))
1511 lsp#stream() *lsp#stream()*
1513 Stream api to listen to responses and notifications from language server or
1514 vim-lsp. Always verify the existence of request, response and server before
1515 accessing. Subscribing to stream should never throw an error.
1517 function! s:on_textDocumentDiagnostics(x) abort
1518 echom 'Diagnostics for ' . a:x['server'] . ' ' . json_encode(a:x['response'])
1521 au User lsp_setup call lsp#callbag#pipe(
1523 \ lsp#callbag#filter({x-> has_key(x, 'response') && !has_key(x['response'], 'error') && get(x['response'], 'method', '') == 'textDocument/publishDiagnostics'}),
1524 \ lsp#callbag#subscribe({ 'next':{x->s:on_textDocumentDiagnostics(x)} }),
1527 Custom vim-lsp notifications streams:
1528 vimp-lsp events mimic lsp server notifications.
1529 * `server` is always `$vimlsp`.
1530 * `response` `method` is always prefixed with ``$/vimlsp/`
1533 |$/vimlsp/lsp_server_exit|
1534 This is similar to |lsp_server_exit| autocommand.
1538 "server": "$vimlsp",
1540 "method": "$/vimlsp/lsp_server_exit",
1541 "params": { "server": "$vimlsp" }
1545 lsp#stop_server({name-of-server}) *lsp#stop_server()*
1547 Used to stop the server.
1550 call lsp#stop_server('name-of-server')
1553 * If the server is not running or is not registered it is a noop.
1554 * The server is forcefully stopped without sending shutdown request.
1556 lsp#get_server_status({name-of-server}) *lsp#get_server_status()*
1558 Get the status of a server.
1561 call lsp#get_server_status('name-of-server')
1563 Returns one of "unknown server", " "exited", "starting", "failed",
1564 "running", "not running".
1567 lsp#utils#position#lsp_to_vim({expr}, {position}) *lsp#utils#position#lsp_to_vim()*
1569 Convert LSP's position to vim's pos ([lnum, col]).
1571 {expr} is same of bufname argument.
1572 {position} is LSP's position params.
1575 lsp#utils#position#vim_to_lsp({expr}, {pos}) *lsp#utils#position#vim_to_lsp()*
1577 Convert vim's pos to LSP's position ({ 'line': ..., 'character': ... }).
1579 {expr} is same of bufname argument.
1580 {pos} is vim's position params.
1582 *lsp#utils#find_nearest_parent_file_directory()*
1583 lsp#utils#find_nearest_parent_file_directory({path}, {filename})
1585 Find the nearest parent directory which contains the specific files or
1586 diretories. The method has two parameters. The first is the path where
1587 searching starts. The second is the files or directories names which
1588 you want to find. The return value is the directory path which is found
1590 This method is mainly used to generate 'root_uri' when registering server.
1593 if executable('ccls')
1594 au User lsp_setup call lsp#register_server({
1596 \ 'cmd': {server_info->['ccls']},
1597 \ 'root_uri':{server_info->lsp#utils#path_to_uri(
1598 \ lsp#utils#find_nearest_parent_file_directory(
1599 \ lsp#utils#get_buffer_path(),
1600 \ ['.ccls', 'compile_commands.json', '.git/']
1602 \ 'initialization_options': {},
1603 \ 'allowlist': ['c', 'cpp', 'objc', 'objcpp', 'cc'],
1608 * The second parameter can be a |String| or a string |List|.
1609 * For the second parameter, the string ends with '/' or '\' will
1610 be regarded as a directory name, otherwise as a file name.
1611 * If there is not directory with the specific files or diretories
1612 found, the method will return an empty string.
1614 lsp#enable_diagnostics_for_buffer() *lsp#enable_diagnostic_for_buffer()*
1616 Re-enable diagnostics for the specified buffer. By default diagnostics are
1617 enabled for all buffers.
1620 :call lsp#enable_diagnostics_for_buffer()
1621 :call lsp#enable_diagnostics_for_buffer(bufnr('%'))
1623 lsp#disable_diagnostics_for_buffer() *lsp#disable_diagnostics_for_buffer()*
1625 Diable diagnostics for the specified buffer. By default diagnostics are
1626 enabled for all buffers.
1629 :call lsp#enable_diagnostics_for_buffer()
1630 :call lsp#enable_diagnostics_for_buffer(bufnr('%'))
1632 Diagnostics can be disabled for buffer to temporarily avoid conflicts with
1636 augroup LspEasyMotion
1638 autocmd User EasyMotionPromptBegin call lsp#disable_diagnostics_for_buffer()<CR>
1639 autocmd User EasyMotionPromptEnd call lsp#enable_diagnostics_for_buffer()<CR>
1642 lsp#get_buffer_diagnostics_counts() *lsp#get_buffer_diagnostics_counts()*
1644 Get dict with diagnostic counts for current buffer. Useful e.g. for display
1647 Returns dictionary with keys "error", "warning", "information", "hint".
1649 lsp#get_buffer_first_error_line() *lsp#get_buffer_first_error_line()*
1651 Get line number of first error in current buffer.
1653 Returns |Number| or |v:null| if there are no errors.
1655 lsp#get_progress() *lsp#get_progress()*
1657 Return UI |List| of |Dict| with window/workDoneProgress
1658 The |List| is most recently update order.
1659 The |Dict| has keys as follows.
1670 0 - 100 or not exist
1672 lsp#document_hover_preview_winid() *lsp#document_hover_preview_winid()*
1674 Returns |windowid| of the current hover preview window or |v:null| if it does not
1677 lsp#scroll(count) *lsp#scroll()*
1679 Scroll current displayed floating/popup window with specified count.
1682 nnoremap <buffer> <expr><c-f> lsp#scroll(+4)
1683 nnoremap <buffer> <expr><c-d> lsp#scroll(-4)
1685 ==============================================================================
1686 Commands *vim-lsp-commands*
1688 LspAddTreeCallHierarchyIncoming *:LspAddTreeCallHierarchyIncoming*
1690 Just like |LspCallHierarchyIncoming| , but instead of making a new list the
1691 result is appended to the current list.
1693 LspAddTreeReferences *:LspAddTreeReferences*
1695 Just like |LspReferences| , but instead of making a new list the result is
1696 appended to the current list.
1698 LspCallHierarchyIncoming *:LspCallHierarchyIncoming*
1700 Find incoming call hierarchy for the symbol under cursor.
1702 LspCallHierarchyOutgoing *:LspCallHierarchyOutgoing*
1704 Find outgoing call hierarchy for the symbol under cursor.
1706 LspCodeAction [--ui=float|preview] [{CodeActionKind}] *:LspCodeAction*
1708 Gets a list of possible commands that can be applied to a file so it can be
1711 If the optional {CodeActionKind} specified, will invoke code action
1712 immediately when matched code action is one only.
1714 LspCodeActionSync [--ui=float|preview] [{CodeActionKind}] *:LspCodeActionSync*
1716 Same as |:LspCodeAction| but synchronous. Useful when running |:autocmd|
1717 commands such as organize imports before save.
1720 autocmd BufWritePre <buffer>
1721 \ call execute('LspCodeActionSync source.organizeImports')
1723 LspCodeLens *:LspCodeLens*
1725 Gets a list of possible commands that can be executed on the current document.
1727 LspDocumentDiagnostics *:LspDocumentDiagnostics*
1729 Gets the document diagnostics and opens in |location-list|. By default
1730 diagnostics are filtered for current buffer.
1734 --buffers Defaults to empty string, i.e. shows diagnostics for current
1735 buffer. To show diagnostic for all buffers use `--buffers=*`.
1738 :LspDocumentDiagnostics
1739 :LspDocumentDiagnostics --buffers=*
1741 LspDeclaration *:LspDeclaration*
1743 Go to declaration. Useful for languages such as C/C++ where there is a clear
1744 distinction between declaration and definition.
1745 This accepts |<mods>|.
1747 Also see |:LspPeekDeclaration|.
1749 LspDefinition *:LspDefinition*
1752 This accepts |<mods>|.
1754 Also see |:LspPeekDefinition|.
1756 LspDocumentFold *:LspDocumentFold*
1758 Recalculate folds for the current buffer.
1760 LspDocumentFoldSync *:LspDocumentFoldSync*
1762 Same as |:LspDocumentFold|, but synchronous.
1764 LspDocumentFormat *:LspDocumentFormat*
1766 Format the entire document.
1768 LspDocumentFormatSync *:LspDocumentFormatSync*
1770 Same as |:LspDocumentFormat| but synchronous. Useful when running |:autocmd|
1771 commands such as formatting before save. Set |g:lsp_format_sync_timeout| to
1775 autocmd BufWritePre <buffer> LspDocumentFormatSync
1777 Note that this may slow down vim.
1779 LspDocumentRangeFormat *:LspDocumentRangeFormat*
1781 Format the current document selection.
1783 LspDocumentRangeFormatSync *:LspDocumentRangeFormatSync*
1785 Same as |:LspDocumentRangeFormat| but synchronous. Useful when running :autocmd
1786 commands. Set |g:lsp_format_sync_timeout| to configure timeouts.
1788 Note that this may slow down vim.
1790 LspDocumentSymbol *:LspDocumentSymbol*
1792 Gets the symbols for the current document.
1794 LspDocumentSymbolSearch *:LspDocumentSymbolSearch*
1796 Search the symbols for the current document and navigate.
1798 LspHover [--ui=float|preview] *:LspHover*
1800 Gets the hover information and displays it in the |preview-window|.
1802 * |preview-window| can be closed using the default vim mapping - `<c-w><c-z>`.
1803 * To control the default focus of |preview-window| for |:LspHover|
1804 configure |g:lsp_preview_keep_focus|.
1805 * If using neovim with nvim_win_open() available, |g:lsp_preview_float| can
1806 be set to enable a floating preview at the cursor which is closed
1807 automatically on cursormove if not focused and can be closed with <C-c> if
1812 :LspHover --ui=float
1813 :LspHover --ui=preview
1815 LspNextDiagnostic [-wrap=0] *:LspNextDiagnostic*
1817 Jump to Next diagnostics including error, warning, information, hint.
1818 With '-wrap=0', stop wrapping around the end of file.
1820 LspNextError [-wrap=0] *:LspNextError*
1822 Jump to Next err diagnostics
1823 With '-wrap=0', stop wrapping around the end of file.
1825 LspNextReference *:LspNextReference*
1827 Jump to the next reference of the symbol under cursor.
1829 LspNextWarning [-wrap=0] *:LspNextWarning*
1831 Jump to Next warning diagnostics
1832 With '-wrap=0', stop wrapping around the end of file.
1834 LspPeekDeclaration *:LspPeekDeclaration*
1836 Like |:LspDeclaration|, but opens the declaration in the |preview-window|
1837 instead of the current window.
1839 Also see |g:lsp_peek_alignment| and |g:lsp_preview_float|.
1841 LspPeekDefinition *:LspPeekDefinition*
1843 Like |:LspDefinition|, but opens the definition in the |preview-window|
1844 instead of the current window.
1846 Also see |g:lsp_peek_alignment| and |g:lsp_preview_float|.
1848 LspPeekImplementation *:LspPeekImplementation*
1850 Like |:LspImplementation|, but opens the implementation in the
1851 |preview-window| instead of the current window.
1853 Also see |g:lsp_peek_alignment| and |g:lsp_preview_float|.
1855 LspPeekTypeDefinition *:LspPeekTypeDefinition*
1857 Like |:LspTypeDefinition|, but opens the type definition in the
1858 |preview-window| instead of the current window.
1860 Also see |g:lsp_peek_alignment| and |g:lsp_preview_float|.
1862 LspPreviousDiagnostic [-wrap=0] *:LspPreviousDiagnostic*
1864 Jump to Previous diagnostics including error, warning, information, hint.
1865 With '-wrap=0', stop wrapping around the top of file.
1867 LspPreviousError [-wrap=0] *:LspPreviousError*
1869 Jump to Previous err diagnostics
1870 With '-wrap=0', stop wrapping around the top of file.
1872 LspPreviousReference *:LspPreviousReference*
1874 Jump to the previous reference of the symbol under cursor.
1876 LspPreviousWarning [-wrap=0] *:LspPreviousWarning*
1878 Jump to Previous warning diagnostics
1879 With '-wrap=0', stop wrapping around the top of file.
1881 LspImplementation *:LspImplementation*
1883 Find all implementation of interface.
1884 This accepts |<mods>|.
1886 Also see |:LspPeekImplementation|.
1888 LspReferences *:LspReferences*
1890 Find all references.
1892 LspRename *:LspRename*
1896 LspSemanticHighlightGroups *:LspSemanticHighlightGroups*
1898 List the highlight groups provided by the current semantic tokens server.
1900 LspTypeDefinition *:LspTypeDefinition*
1902 Go to the type definition.
1903 This accepts |<mods>|.
1905 LspTypeHierarchy *:LspTypeHierarchy*
1907 View type hierarchy for the symbol under cursor.
1909 Also see |:LspPeekTypeDefinition|.
1911 LspWorkspaceSymbol *:LspWorkspaceSymbol*
1913 Search and show workspace symbols in quickfix.
1914 Servers may choose to return empty results if the search query is empty.
1916 LspWorkspaceSymbolSearch *:LspWorkspaceSymbolSearch*
1918 Search the workspace symbols for all servers and navigate using quickpick.
1919 Servers may choose to return empty results if the search query is empty.
1921 LspStatus *:LspStatus*
1923 Prints the status of all registered servers. Use `:verbose LspStatus` to
1924 additionally show each server's workspace_config.
1925 See also |vim-lsp-healthcheck|.
1927 LspStopServer[!] [name] *:LspStopServer*
1931 Stops all active servers that handle files matching the current buffer type.
1932 This is often what you want. For example, if you have multiple files of
1933 different types open, `LspStopServer` will only stop the server for the
1934 current buffer. Shows an error if there are no active LSP servers for the
1939 Stops all active servers, regardless of the current buffer type. Shows a
1940 message for every stopped server.
1944 Stops a server named 'name', comparing the provided ID with the value of the
1945 the 'name' property in the |lsp#register_server()| call. Shows an error if
1946 'name' does not match a defined and currently running server.
1948 Completion should list only currently running servers for the 'name' argument.
1950 ==============================================================================
1951 Autocommands *vim-lsp-autocommands*
1953 lsp_setup *lsp_setup*
1955 This autocommand is run once after vim-lsp is enabled. The server should be
1956 registered when this event is triggered.
1958 lsp_complete_done *lsp_complete_done*
1960 This autocommand is run after Insert mode completion is done, similar to
1961 |CompleteDone|. However, the difference is that |lsp_complete_done| is run
1962 only after vim-lsp has finished executing its internal |CompleteDone|
1963 autocommands (e.g. applying text edits). It is thus ideal to use for snippet
1964 expansion, or custom post processing of completed items. Just like
1965 |CompleteDone|, the Vim variable |v:completed_item| contains information about
1966 the completed item. It is guaranteed that vim-lsp does not change the content
1967 of this variable during its |CompleteDone| autocommands.
1969 lsp_float_opened *lsp_float_opened*
1971 This autocommand is run after the floating window is shown for preview.
1972 See also |preview-window|
1974 lsp_float_closed *lsp_float_closed*
1976 This autocommand is run after the floating window is closed.
1977 See also |preview-window|
1979 lsp_float_focused *lsp_float_focused*
1981 This autocommand is run after the floating window is focused. Only supported in
1984 You can map `<Plug>(lsp-float-close)` to close the floating window.
1986 lsp_register_server *lsp_register_server*
1988 This autocommand is run after the server is registered.
1990 lsp_unregister_server *lsp_unregister_server*
1992 This autocommand is run after the server is unregistered.
1994 lsp_server_init *lsp_server_init*
1996 This autocommand is run after the server is initialized.
1998 lsp_server_exit *lsp_server_exit*
2000 This autocommand is run after the server is exited.
2002 lsp_buffer_enabled *lsp_buffer_enabled*
2004 This autocommand is run after vim-lsp is enabled for the buffer. This event is
2005 triggered immediately when the buffer is currently active. If the buffer is not
2006 current active, the event will be triggered when the buffer will be active.
2008 lsp_diagnostics_updated *lsp_diagnostics_updated*
2010 This autocommand us run after every time after new diagnostics received and
2011 processed by vim-lsp.
2013 function! DoSomething
2014 echo lsp#get_buffer_diagnostics_counts()
2019 autocmd User lsp_diagnostics_updated call DoSomething()
2022 lsp_progress_updated *lsp_progress_updated*
2024 This autocommand is run after every time after progress updated and
2025 processed by vim-lsp. Used for statusline plugins.
2027 ==============================================================================
2028 Mappings *vim-lsp-mappings*
2030 To map keys to the feature of vim-lsp, use <plug> mappings:
2032 autocmd FileType python,go nmap gd <plug>(lsp-definition)
2034 Available plug mappings are following:
2036 nnoremap <plug>(lsp-call-hierarchy-incoming)
2037 nnoremap <plug>(lsp-call-hierarchy-outgoing)
2038 nnoremap <plug>(lsp-code-action)
2039 nnoremap <plug>(lsp-code-action-float)
2040 nnoremap <plug>(lsp-code-action-preview)
2041 nnoremap <plug>(lsp-code-lens)
2042 nnoremap <plug>(lsp-declaration)
2043 nnoremap <plug>(lsp-peek-declaration)
2044 nnoremap <plug>(lsp-definition)
2045 nnoremap <plug>(lsp-peek-definition)
2046 nnoremap <plug>(lsp-document-symbol)
2047 nnoremap <plug>(lsp-document-symbol-search)
2048 nnoremap <plug>(lsp-document-diagnostics)
2049 nnoremap <plug>(lsp-hover)
2050 nnoremap <plug>(lsp-hover-float)
2051 nnoremap <plug>(lsp-hover-preview)
2052 nnoremap <plug>(lsp-next-diagnostic)
2053 nnoremap <plug>(lsp-next-diagnostic-nowrap)
2054 nnoremap <plug>(lsp-next-error)
2055 nnoremap <plug>(lsp-next-error-nowrap)
2056 nnoremap <plug>(lsp-next-reference)
2057 nnoremap <plug>(lsp-next-warning)
2058 nnoremap <plug>(lsp-next-warning-nowrap)
2059 nnoremap <plug>(lsp-preview-close)
2060 nnoremap <plug>(lsp-preview-focus)
2061 nnoremap <plug>(lsp-previous-diagnostic)
2062 nnoremap <plug>(lsp-previous-diagnostic-nowrap)
2063 nnoremap <plug>(lsp-previous-error)
2064 nnoremap <plug>(lsp-previous-error-nowrap)
2065 nnoremap <plug>(lsp-previous-reference)
2066 nnoremap <plug>(lsp-previous-warning)
2067 nnoremap <plug>(lsp-previous-warning-nowrap)
2068 nnoremap <plug>(lsp-references)
2069 nnoremap <plug>(lsp-rename)
2070 nnoremap <plug>(lsp-workspace-symbol)
2071 nnoremap <plug>(lsp-workspace-symbol-search)
2072 nnoremap <plug>(lsp-document-format)
2073 vnoremap <plug>(lsp-document-format)
2074 nnoremap <plug>(lsp-document-range-format)
2075 xnoremap <plug>(lsp-document-range-format)
2076 nnoremap <plug>(lsp-implementation)
2077 nnoremap <plug>(lsp-peek-implementation)
2078 nnoremap <plug>(lsp-type-definition)
2079 nnoremap <plug>(lsp-peek-type-definition)
2080 nnoremap <plug>(lsp-type-hierarchy)
2081 nnoremap <plug>(lsp-status)
2082 nnoremap <plug>(lsp-signature-help)
2084 See also |vim-lsp-commands|
2086 <plug>(lsp-preview-close) *<plug>(lsp-preview-close)*
2088 Closes an opened preview window
2090 <plug>(lsp-preview-focus) *<plug>(lsp-preview-focus)*
2092 Transfers focus to an opened preview window or back to the previous window if
2093 focus is already on the preview window.
2096 ==============================================================================
2097 Autocomplete *vim-lsp-autocomplete*
2099 omnifunc *vim-lsp-omnifunc*
2101 vim-lsp by default only provides basic omnifunc support for autocomplete.
2103 Completion can be made asynchronous by setting g:lsp_async_completion.
2104 Note that this may cause unexpected behavior in some plugins such as
2107 If you would like to have more advanced features please use asyncomplete.vim
2111 autocmd FileType typescript setlocal omnifunc=lsp#complete
2113 asyncomplete.vim *vim-lsp-asyncomplete*
2115 asyncomplete.vim is a async auto complete plugin for vim8 and neovim written
2116 in pure vim script. https://github.com/prabirshrestha/asyncomplete.vim
2119 Plug 'prabirshrestha/vim-lsp'
2120 Plug 'prabirshrestha/asyncomplete.vim'
2121 Plug 'prabirshrestha/asyncomplete-lsp.vim'
2123 For additional configuration refer to asyncomplete.vim docs.
2125 ==============================================================================
2126 Tagfunc *vim-lsp-tagfunc*
2128 vim-lsp can integrate with vim's native tag functionality for navigating code
2129 using the |'tagfunc'| option (requires vim/neovim with patch-8.1.1228).
2132 autocmd FileType typescript setlocal tagfunc=lsp#tagfunc
2134 ==============================================================================
2135 Snippets *vim-lsp-snippets*
2137 To integrate snippets in vim-lsp, you will first have to install a third-party
2138 snippet plugin, and a plugin that integrates it in vim-lsp. At the moment,
2139 you have two options:
2142 https://github.com/hrsh7th/vim-vsnip
2143 https://github.com/hrsh7th/vim-vsnip-integ
2145 2. UltiSnips and vim-lsp-ultisnips
2146 https://github.com/SirVer/ultisnips
2147 https://github.com/thomasfaingnaert/vim-lsp-ultisnips
2149 3. neosnippet.vim and vim-lsp-neosnippet
2150 https://github.com/Shougo/neosnippet.vim
2151 https://github.com/thomasfaingnaert/vim-lsp-neosnippet
2153 Refer to the readme and docs of vim-vsnip, vim-lsp-ultisnips and
2154 vim-lsp-neosnippet for more information and configuration options.
2156 ==============================================================================
2157 Folding *vim-lsp-folding*
2159 You can also let the language server handle folding for you. To enable this
2160 feature, you will have to set 'foldmethod', 'foldexpr' and 'foldtext' (the
2161 latter is optional) correctly:
2164 \ foldexpr=lsp#ui#vim#folding#foldexpr()
2165 \ foldtext=lsp#ui#vim#folding#foldtext()
2167 Also, make sure you have not disabled folding globally, see
2168 |g:lsp_fold_enabled|.
2170 You may want to enable this only for certain filetypes, e.g. for Javascript
2175 autocmd FileType javascript setlocal
2177 \ foldexpr=lsp#ui#vim#folding#foldexpr()
2178 \ foldtext=lsp#ui#vim#folding#foldtext()
2181 To display open and closed folds at the side of the window, see
2183 If you want to remove the dashes at the end of the folds, you can change
2184 the fold item of 'fillchars'.
2186 ==============================================================================
2187 Semantic highlighting *vim-lsp-semantic*
2189 To use semantic highlighting, you need Neovim highlights, or Vim with the
2190 |textprop| feature enabled at compile time.
2192 To enable semantic highlighting, |g:lsp_semantic_enabled| should be set to `1`
2193 (it is `0` by default). You can check if semantic highlighting is enabled
2195 echo lsp#internal#semantic#is_enabled()
2197 vim-lsp provides |highlight| groups for each of the token types supported by
2198 the current LSP server. This includes highlight groups for each of the
2199 standard set of token types:
2201 * `LspSemanticClass`
2203 * `LspSemanticInterface`
2204 * `LspSemanticStruct`
2205 * `LspSemanticTypeParameter`
2206 * `LspSemanticParameter`
2207 * `LspSemanticVariable`
2208 * `LspSemanticProperty`
2209 * `LspSemanticEnumMember`
2210 * `LspSemanticEvents`
2211 * `LspSemanticFunction`
2212 * `LspSemanticMethod`
2213 * `LspSemanticKeyword`
2214 * `LspSemanticModifier`
2215 * `LspSemanticComment`
2216 * `LspSemanticString`
2217 * `LspSemanticNumber`
2218 * `LspSemanticRegexp`
2219 * `LspSemanticOperator`
2220 as well as additional highlight groups for any further types supported by the
2221 server. For example, clangd provides `LspNamespace`.
2223 The standard set of token types have sensible defaults provided, however
2224 any other types require manual configuration. The types provided by the
2225 current buffer's semantic tokens server can be found by running
2226 |:LspSemanticTokenTypes|.
2228 LSP servers may also provide modifiers for each of the tokens. The standard
2240 Servers may also provide their own modifiers. The full set of types provided
2241 by the current buffer's semantic tokens server can be found by running
2242 |:LspSemanticTokenModifiers|.
2244 If modifiers are applied to a token, the name of the |highlight| group will
2245 be prepended with each of the modifier names, for example a static default
2246 library function will use the highlight group
2247 `LspSemanticStaticDefaultLibraryFunction`. By default, any modified highlight
2248 groups are linked to their unmodified equivalent.
2250 ==============================================================================
2251 Popup Formatting *vim-lsp-popup-format*
2253 Popup windows use the |gq| operator for formatting content to the window.
2255 For customization, see
2258 ==============================================================================
2259 Workspace Folders *vim-lsp-workspace-folders*
2261 Workspace folders is an experimental feature of vim-lsp. To enable workspace
2262 folders set `let g:lsp_experimental_workspace_folders = 1`. In the future this
2263 flag will be removed and workspace folders will be enabled by default.
2265 When a new buffer is opened, if the server supports workspace folder, it will
2266 call `root_uri` function to detect the workspace folder. If the folder is not
2267 part of workspace folder, it will automatically notify the server to add the
2270 =============================================================================
2271 License *vim-lsp-license*
2273 The MIT License (MIT)
2275 Full license text: https://github.com/prabirshrestha/vim-lsp/blob/master/LICENSE
2277 ==============================================================================
2278 Maintainers *vim-lsp-maintainers*
2280 * Prabir Shrestha (author, maintainer): https://github.com/prabirshrestha
2281 * mattn (maintainer): https://github.com/mattn
2282 * hrsh7th (maintainer): https://github.com/hrsh7th
2283 * Thomas Faingnaert (maintainer): https://github.com/thomasfaingnaert
2284 * rhysd (maintainer): https://github.com/rhysd
2286 vim:tw=78:ts=8:ft=help:norl:noet:fen:noet: