forked from prabirshrestha/vim-lsp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvim-lsp.txt
2286 lines (1765 loc) · 82.2 KB
/
vim-lsp.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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
*vim-lsp.txt* Async Language Server Protocol (LSP) for Vim 8 and Neovim.
*vim-lsp*
==============================================================================
CONTENTS *vim-lsp-contents*
Introduction |vim-lsp-introduction|
Install |vim-lsp-install|
Performance |vim-lsp-performance|
Language Servers |vim-lsp-language-servers|
Configure |vim-lsp-configure|
vim-lsp-settings |vim-lsp-settings_plugin|
Wiki |vim-lsp-configure-wiki|
Health Check |vim-lsp-healthcheck|
Options |vim-lsp-options|
g:lsp_auto_enable |g:lsp_auto_enable|
g:lsp_use_native_client |g:lsp_use_native_client|
g:lsp_preview_keep_focus |g:lsp_preview_keep_focus|
g:lsp_preview_float |g:lsp_preview_float|
g:lsp_preview_autoclose |g:lsp_preview_autoclose|
g:lsp_preview_doubletap |g:lsp_preview_doubletap|
g:lsp_insert_text_enabled |g:lsp_insert_text_enabled|
g:lsp_text_edit_enabled |g:lsp_text_edit_enabled|
g:lsp_completion_documentation_enabled
|g:lsp_completion_documentation_enabled|
g:lsp_completion_documentation_delay
|g:lsp_completion_documentation_delay|
g:lsp_diagnostics_enabled |g:lsp_diagnostics_enabled|
g:lsp_diagnostics_echo_cursor |g:lsp_diagnostics_echo_cursor|
g:lsp_diagnostics_echo_delay |g:lsp_diagnostics_echo_delay|
g:lsp_diagnostics_float_cursor |g:lsp_diagnostics_float_cursor|
g:lsp_diagnostics_float_delay |g:lsp_diagnostics_float_delay|
g:lsp_diagnostics_float_insert_mode_enabled
|g:lsp_diagnostics_float_insert_mode_enabled|
g:lsp_diagnostics_highlights_enabled
|g:lsp_diagnostics_highlights_enabled|
g:lsp_diagnostics_highlights_insert_mode_enabled
|g:lsp_diagnostics_highlights_insert_mode_enabled|
g:lsp_diagnostics_highlights_delay
|g:lsp_diagnostics_highlights_delay|
g:lsp_diagnostics_signs_enabled |g:lsp_diagnostics_signs_enabled|
g:lsp_diagnostics_signs_insert_mode_enabled
|g:lsp_diagnostics_signs_insert_mode_enabled|
g:lsp_diagnostics_signs_delay |g:lsp_diagnostics_signs_delay|
g:lsp_diagnostics_signs_priority |g:lsp_diagnostics_signs_priority|
g:lsp_diagnostics_signs_priority_map
|g:lsp_diagnostics_signs_priority_map|
g:lsp_diagnostics_virtual_text_enabled
|g:lsp_diagnostics_virtual_text_enabled|
g:lsp_diagnostics_virtual_text_insert_mode_enabled
|g:lsp_diagnostics_virtual_text_insert_mode_enabled|
g:lsp_diagnostics_virtual_text_delay
|g:lsp_diagnostics_virtual_text_delay|
g:lsp_diagnostics_virtual_text_align
|g:lsp_diagnostics_virtual_text_align|
g:lsp_diagnostics_virtual_text_padding_left
|g:lsp_diagnostics_virtual_text_padding_left|
g:lsp_diagnostics_virtual_text_wrap
|g:lsp_diagnostics_virtual_text_wrap|
g:lsp_document_code_action_signs_enabled
|g:lsp_document_code_actions_signs_enabled|
g:lsp_document_code_action_signs_delay
|g:lsp_document_code_actions_signs_delay|
g:lsp_inlay_hints_enabled
|g:lsp_inlay_hints_enabled|
g:lsp_inlay_hints_delay
|g:lsp_inlay_hints_delay|
g:lsp_inlay_hints_mode
|g:lsp_inlay_hints_mode|
g:lsp_tree_incoming_prefix |g:lsp_tree_incoming_prefix|
g:lsp_format_sync_timeout |g:lsp_format_sync_timeout|
g:lsp_use_event_queue |g:lsp_use_event_queue|
g:lsp_max_buffer_size |g:lsp_max_buffer_size|
g:lsp_document_highlight_enabled |g:lsp_document_highlight_enabled|
g:lsp_document_highlight_delay |g:lsp_document_highlight_delay|
g:lsp_get_supported_capabilities |g:lsp_get_supported_capabilities|
g:lsp_document_symbol_detail |g:lsp_document_symbol_detail|
g:lsp_peek_alignment |g:lsp_peek_alignment|
g:lsp_preview_max_width |g:lsp_preview_max_width|
g:lsp_preview_max_height |g:lsp_preview_max_height|
g:lsp_preview_fixup_conceal |g:lsp_preview_fixup_conceal|
g:lsp_float_max_width |g:lsp_float_max_width|
g:lsp_signature_help_enabled |g:lsp_signature_help_enabled|
g:lsp_fold_enabled |g:lsp_fold_enabled|
g:lsp_hover_conceal |g:lsp_hover_conceal|
g:lsp_hover_ui |g:lsp_hover_ui|
g:lsp_ignorecase |g:lsp_ignorecase|
g:lsp_log_file |g:lsp_log_file|
g:lsp_log_verbose |g:lsp_log_verbose|
g:lsp_semantic_enabled |g:lsp_semantic_enabled|
g:lsp_semantic_delay |g:lsp_semantic_delay|
g:lsp_text_document_did_save_delay |g:lsp_text_document_did_save_delay|
g:lsp_snippet_expand |g:lsp_snippet_expand|
g:lsp_completion_resolve_timeout |g:lsp_completion_resolve_timeout|
g:lsp_tagfunc_source_methods |g:lsp_tagfunc_source_methods|
g:lsp_show_message_request_enabled |g:lsp_show_message_request_enabled|
g:lsp_work_done_progress_enabled |g:lsp_work_done_progress_enabled|
g:lsp_show_message_log_level |g:lsp_show_message_log_level|
g:lsp_untitled_buffer_enabled |g:lsp_untitled_buffer_enabled|
Functions |vim-lsp-functions|
lsp#enable |lsp#enable()|
lsp#disable |lsp#disable()|
lsp#register_server |lsp#register_server()|
lsp#register_command |lsp#register_command()|
lsp#stream |lsp#stream()|
lsp#stop_server |lsp#stop_server()|
lsp#utils#find_nearest_parent_file_directory()
|lsp#utils#find_nearest_parent_file_directory()|
lsp#enable_diagnostics_for_buffer() |lsp#enable_diagnostics_for_buffer()|
lsp#disable_diagnostics_for_buffer()|lsp#disable_diagnostics_for_buffer()|
lsp#get_buffer_diagnostics_counts() |lsp#get_buffer_diagnostics_counts()|
lsp#get_buffer_first_error_line() |lsp#get_buffer_first_error_line()|
lsp#get_progress() |lsp#get_progress()|
lsp#document_hover_preview_winid() |lsp#document_hover_preview_winid()|
Commands |vim-lsp-commands|
LspAddTreeCallHierarchyIncoming |:LspAddTreeCallHierarchyIncoming|
LspAddTreeReferences |:LspAddTreeReferences|
LspCallHierarchyIncoming |:LspCallHierarchyIncoming|
LspCallHierarchyOutgoing |:LspCallHierarchyOutgoing|
LspCodeAction |:LspCodeAction|
LspCodeActionSync |:LspCodeActionSync|
LspCodeLens |:LspCodeLens|
LspDocumentDiagnostics |:LspDocumentDiagnostics|
LspDeclaration |:LspDeclaration|
LspDefinition |:LspDefinition|
LspDocumentFold |:LspDocumentFold|
LspDocumentFoldSync |:LspDocumentFoldSync|
LspDocumentFormat |:LspDocumentFormat|
LspDocumentFormatSync |:LspDocumentFormatSync|
LspDocumentRangeFormat |:LspDocumentRangeFormat|
LspDocumentRangeFormatSync |:LspDocumentRangeFormatSync|
LspDocumentSymbol |:LspDocumentSymbol|
LspDocumentSymbolSearch |:LspDocumentSymbolSearch|
LspHover |:LspHover|
LspNextDiagnostic |:LspNextDiagnostic|
LspNextError |:LspNextError|
LspNextReference |:LspNextReference|
LspNextWarning |:LspNextWarning|
LspPeekDeclaration |:LspPeekDeclaration|
LspPeekDefinition |:LspPeekDefinition|
LspPeekImplementation |:LspPeekImplementation|
LspPeekTypeDefinition |:LspPeekTypeDefinition|
LspPreviousDiagnostic |:LspPreviousDiagnostic|
LspPreviousError |:LspPreviousError|
LspPreviousReference |:LspPreviousReference|
LspPreviousWarning |:LspPreviousWarning|
LspImplementation |:LspImplementation|
LspReferences |:LspReferences|
LspRename |:LspRename|
LspSemanticHighlightGroups |:LspSemanticHighlightGroups|
LspTypeDefinition |:LspTypeDefinition|
LspTypeHierarchy |:LspTypeHierarchy|
LspWorkspaceSymbol |:LspWorkspaceSymbol|
LspWorkspaceSymbolSearch |:LspWorkspaceSymbolSearch|
LspStatus |:LspStatus|
LspStopServer |:LspStopServer|
Autocommands |vim-lsp-autocommands|
lsp_setup |lsp_setup|
lsp_complete_done |lsp_complete_done|
lsp_float_opened |lsp_float_opened|
lsp_float_closed |lsp_float_closed|
lsp_float_focused |lsp_float_focused|
lsp_register_server |lsp_register_server|
lsp_unregister_server |lsp_unregister_server|
lsp_server_init |lsp_server_init|
lsp_server_exit |lsp_server_exit|
lsp_buffer_enabled |lsp_buffer_enabled|
lsp_diagnostics_updated |lsp_diagnostics_updated|
lsp_progress_updated |lsp_progress_updated|
Mappings |vim-lsp-mappings|
<plug>(lsp-preview-close) |<plug>(lsp-preview-close)|
<plug>(lsp-preview-focus) |<plug>(lsp-preview-focus)|
Autocomplete |vim-lsp-autocomplete|
omnifunc |vim-lsp-omnifunc|
asyncomplete.vim |vim-lsp-asyncomplete|
Tagfunc |vim-lsp-tagfunc|
Snippets |vim-lsp-snippets|
Folding |vim-lsp-folding|
Semantic highlighting |vim-lsp-semantic|
Popup Formatting |vim-lsp-popup-format|
Workspace Folders |vim-lsp-workspace-folders|
License |vim-lsp-license|
Maintainers |vim-lsp-maintainers|
==============================================================================
INTRODUCTION *vim-lsp-introduction*
Async Language Server Protocol (LSP) for Vim 8 and Neovim.
For more information on LSP refer to the official website at
https://microsoft.github.io/language-server-protocol/
==============================================================================
INSTALL *vim-lsp-install*
Install vim-lsp plugin. Below is a sample using plug.vim
>
Plug 'prabirshrestha/vim-lsp'
==============================================================================
PERFORMANCE *vim-lsp-performance*
While Vim script is very portable it has performance implications. If you would
like to improve performance make sure you have vim/neovim with lua support.
Currently only diff algorithm uses lua internally if available.
Following is the default value used to detect lua.
>
let g:lsp_use_lua = has('nvim-0.4.0') || (has('lua') && has('patch-8.2.0775'))
Windows users can download the binaries from the following url and place
lua53.dll in the `PATH` or besides `vim.exe` or `gvim.exe` executables.
32 bit:
http://downloads.sourceforge.net/luabinaries/lua-5.3.2_Win32_dllw4_lib.zip
64bit:
http://downloads.sourceforge.net/luabinaries/lua-5.3.2_Win64_dllw4_lib.zip
If you are using vim set `let g:lsp_use_native_client = 1` and make sure you
are running vim 8.2.4780+.
Set |g:lsp_semantic_enabled| to 0.
Set |g:lsp_format_sync_timeout| to a reasonable value such as `1000`.
==============================================================================
LANGUAGE SERVERS *vim-lsp-language-servers*
CONFIGURE *vim-lsp-configure*
vim-lsp doesn't ship with any language servers. The user is responsible for
configuring the language servers correctly.
Here is an example of configuring the python language server protocol based
on pylsp (https://github.com/python-lsp/python-lsp-server)
1. Make sure the language server is available locally in the machine.
For python, pip package manager can be used to install the language server.
>
pip install python-lsp-server
2. Register the language server in your .vimrc
>
if (executable('pylsp'))
au User lsp_setup call lsp#register_server({
\ 'name': 'pylsp',
\ 'cmd': {server_info->['pylsp']},
\ 'allowlist': ['python']
\ })
endif
<
For more details refer to |lsp#register_server()|.
3. Configure your settings for the buffer
Use |lsp_buffer_enabled| autocommand to configure the buffer.
>
function! s:on_lsp_buffer_enabled() abort
setlocal omnifunc=lsp#complete
setlocal signcolumn=yes
nmap <buffer> gd <plug>(lsp-definition)
nmap <buffer> <f2> <plug>(lsp-rename)
endfunction
augroup lsp_install
au!
autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
augroup END
<
TCP SERVERS *vim-lsp-tcp*
You can use tcp to connect to LSP servers that don't support stdio. Set host
and port to tcp. The Godot game engine uses 6008 as its LSP port and godot
ftplugins define gdscript or gdscript3 filetype: >
au User lsp_setup
\ call lsp#register_server({
\ 'name': 'godot',
\ 'tcp': "localhost:6008",
\ 'allowlist': ['gdscript3', 'gdscript']
\ })
>
VIM-LSP-SETTINGS *vim-lsp-settings_plugin*
Refer to [vim-lsp-settings](https://github.com/mattn/vim-lsp-settings) on how
to automatically register various language servers.
>
Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'
HEALTH CHECK *vim-lsp-healthcheck*
vim-lsp supports the |:CheckHealth| command which can be useful when debugging
lsp configuration issues.
This command is implemented in vim with the
[vim-healthcheck](https://github.com/rhysd/vim-healthcheck) plugin.
WIKI *vim-lsp-configure-wiki*
For documentation on how to configure other language servers refer
to https://github.com/prabirshrestha/vim-lsp/wiki/Servers
==============================================================================
Options *vim-lsp-options*
g:lsp_auto_enable *g:lsp_auto_enable*
Type: |Number|
Default: `1`
Auto enable vim-lsp plugin during startup. Set to `0` to disable auto
enabling vim-lsp during startup.
Example: >
let g:lsp_auto_enable = 1
let g:lsp_auto_enable = 0
g:lsp_use_native_client *g:lsp_use_native_client*
Type: |Number|
Default: `0`
Enable native lsp client support for vim 8.2.4780+. No impact for neovim.
TCP language servers are not supported and should be set to 0 if one is
used.
Example: >
let g:lsp_use_native_client = 1
let g:lsp_use_native_client = 0
g:lsp_preview_keep_focus *g:lsp_preview_keep_focus*
Type: |Number|
Default: `1`
Indicates whether to keep the focus on current window or move the focus
to the |preview-window| when a |preview-window| is opened by vim-lsp.
Certain commands such as |:LspHover| opens the result in a
|preview-window|.
Example: >
" Keep the focus in current window
let g:lsp_preview_keep_focus = 1
" Do not keep the focus in current window.
" Move the focus to |preview-window|.
let g:lsp_preview_keep_focus = 0
<
* |preview-window| can be closed using the default vim mapping - `<c-w><c-z>`.
* |preview-window| can be also automatically closed after completion with
the following auto command: >
autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif
< * |preview-window| can be suppressed with: >
set completeopt-=preview
<
g:lsp_preview_float *g:lsp_preview_float*
Type: |Number|
Default: `1`
If set and nvim_win_open() or popup_create is available, hover information
are shown in a floating window as |preview-window| at the cursor position.
The |preview-window| is closed automatically on cursor moves, unless it is
focused. While focused it may be closed with <C-c>.
This feature requires neovim 0.4.0 (current master) or
Vim8.1 with has('patch-8.1.1517').
Example: >
" Opens preview windows as floating
let g:lsp_preview_float = 1
" Opens preview windows as normal windows
let g:lsp_preview_float = 0
<
After opening an autocmd User event lsp_float_opened is issued, as well as
and lsp_float_closed upon closing. This can be used to alter the preview
window (using |lsp#document_hover_preview_winid()| to get the window id),
setup custom bindings while a preview is open, or change the highlighting
of the window.
Example of custom keybindings: >
" Close preview window with <C-c>
autocmd User lsp_float_opened nmap <buffer> <silent> <C-c>
\ <Plug>(lsp-preview-close)
autocmd User lsp_float_closed nunmap <buffer> <C-c>
<
Example of customising the highlighting: >
highlight PopupWindow ctermbg=lightblue guibg=lightblue
augroup lsp_float_colours
autocmd!
if !has('nvim')
autocmd User lsp_float_opened
\ call setwinvar(lsp#document_hover_preview_winid(),
\ '&wincolor', 'PopupWindow')
else
autocmd User lsp_float_opened
\ call nvim_win_set_option(
\ lsp#document_hover_preview_winid(),
\ 'winhighlight', 'Normal:PopupWindow')
endif
augroup end
<
g:lsp_preview_autoclose *g:lsp_preview_autoclose*
Type: |Number|
Default: `1`
Indicates if an opened floating preview shall be automatically closed upon
movement of the cursor. If set to 1, the window will close automatically
if the cursor is moved and the preview is not focused. If set to 0, it
will remain open until explicitly closed (e.g. with
|<plug>(lsp-preview-close)|, or <ESC> when focused).
Example: >
" Preview closes on cursor move
let g:lsp_preview_autoclose = 1
" Preview remains open and waits for an explicit call
let g:lsp_preview_autoclose = 0
g:lsp_preview_doubletap *g:lsp_preview_doubletap*
Type: |List|
Default: `[function('lsp#ui#vim#output#focuspreview')]`
When preview is called twice with the same data while the preview is still
open, the function in `lsp_preview_doubletap` is called instead. To
disable this and just "refresh" the preview, set to ´0´.
Example: >
" Focus preview on repeated preview (does not work for vim8.1 popups)
let g:lsp_preview_doubletap = [function('lsp#ui#vim#output#focuspreview')]
" Closes the preview window on the second call to preview
let g:lsp_preview_doubletap = [function('lsp#ui#vim#output#closepreview')]
" Disables double tap feature; refreshes the preview on consecutive taps
let g:lsp_preview_doubletap = 0
g:lsp_insert_text_enabled *g:lsp_insert_text_enabled*
Type: |Number|
Default: `1`
Enable support for completion insertText property. Set to `0` to disable
using insertText.
Example: >
let g:lsp_insert_text_enabled = 1
let g:lsp_insert_text_enabled = 0
g:lsp_text_edit_enabled *g:lsp_text_edit_enabled*
Type: |Number|
Default: `1`
Enable support for completion textEdit property. Set to `0` to disable
using textEdit.
Example: >
let g:lsp_text_edit_enabled = 1
let g:lsp_text_edit_enabled = 0
g:lsp_completion_documentation_enabled *g:lsp_completion_documentation_enabled*
Type: |Number|
Default: `1`
Enables floating window documentation for complete items.
Example: >
let g:lsp_completion_documentation_enabled = 1
let g:lsp_completion_documentation_enabled = 0
g:lsp_completion_documentation_delay *g:lsp_completion_documentation_delay*
Type: |Number|
Default: `80`
Time in milliseconds to delay the completion documentation popup. Might
help with performance. Set this to `0` to disable debouncing.
Example: >
let g:lsp_completion_documentation_delay = 120
let g:lsp_completion_documentation_delay = 0
g:lsp_diagnostics_enabled *g:lsp_diagnostics_enabled*
Type: |Number|
Default: `1`
Enable support for document diagnostics like warnings and error messages.
enabling vim-lsp during startup.
Refer to |g:lsp_diagnostics_signs_enabled| to enable signs column.
Refer to |g:lsp_diagnostics_virtual_text_enabled| to enable virtual text.
Example: >
let g:lsp_diagnostics_enabled = 1
let g:lsp_diagnostics_enabled = 0
<
g:lsp_diagnostics_echo_cursor *g:lsp_diagnostics_echo_cursor*
Type: |Number|
Default: `0`
Enables echo of diagnostic error for the current line to status. Requires
|g:lsp_diagnostics_enabled| set to 1.
Example: >
let g:lsp_diagnostics_echo_cursor = 1
let g:lsp_diagnostics_echo_cursor = 0
g:lsp_diagnostics_echo_delay *g:lsp_diagnostics_echo_delay*
Type: |Number|
Default: `500`
Delay milliseconds to echo diagnostic error for the current line to status.
Requires |g:lsp_diagnostics_enabled| and |g:lsp_diagnostics_echo_cursor| set
to 1.
Example: >
let g:lsp_diagnostics_echo_delay = 200
let g:lsp_diagnostics_echo_delay = 1000
g:lsp_diagnostics_float_cursor *g:lsp_diagnostics_float_cursor*
Type: |Number|
Default: `0`
Enables a floating window of diagnostic error for the current line to
status. Requires nvim_win_open() or popup_create is available, and
|g:lsp_diagnostics_enabled| set to 1.
Example: >
let g:lsp_diagnostics_float_cursor = 1
let g:lsp_diagnostics_float_cursor = 0
g:lsp_diagnostics_float_delay *g:lsp_diagnostics_float_delay*
Type: |Number|
Default: `500`
Delay milliseconds to show diagnostic error for the current line to status
in a float window. Requires Enables float of diagnostic error for the
current line to status. Requires |g:lsp_diagnostics_enabled| and
|g:lsp_diagnostics_float_cursor| set to 1.
Example: >
let g:lsp_diagnostics_float_delay = 200
let g:lsp_diagnostics_float_delay = 1000
g:lsp_diagnostics_float_insert_mode_enabled
*g:lsp_diagnostics_float_insert_mode_enabled*
Type: |Boolean|
Default: `1`
Indicates whether to enable float of diagnostic error for the current line
to status when in |insertmode|. Requires |g:lsp_diagnostics_enabled| and
|g:lsp_diagnostics_float_cursor| set to 1.
Example: >
let g:lsp_diagnostics_float_insert_mode_enabled = 0
g:lsp_format_sync_timeout *g:lsp_format_sync_timeout*
Type: |Number|
Default: `-1`
Timeout milliseconds to abort `:LspDocumentFormatSync` or
`:LspDocumentRangeFormatSync`. Set to `-1` to disable timeout. Using
`BufWritePre` to execute sync commands may cause vim to hang when using
some language servers as starting the language server may be slow. Set the
timeout value to cancel sync format.
Example: >
let g:lsp_format_sync_timeout = -1
let g:lsp_format_sync_timeout = 1000
g:lsp_diagnostics_highlights_enabled *g:lsp_diagnostics_highlights_enabled*
Type: |Number|
Default: `1` for neovim 0.3+ and vim with patch-8.1.1035
Enables highlighting of diagnostics. Requires NeoVim with version 0.3 or
Vim 8.1.1035 or newer.
Example: >
let g:lsp_diagnostics_highlights_enabled = 1
let g:lsp_diagnostics_highlights_enabled = 0
<
To change the style of the highlighting, you can set or link
`LspErrorHighlight`, `LspWarningHighlight`, `LspInformationHighlight` and
`LspHintHighlight` highlight groups.
Example: >
highlight link LspErrorHighlight Error
g:lsp_diagnostics_highlights_insert_mode_enabled
*g:lsp_diagnostics_highlights_insert_mode_enabled*
Type: |Number|
Default: `1`
Indicates whether to enable diagnostics highlighting when in |insertmode|.
Requires |g:lsp_diagnostics_highlights_enabled|.
Example: >
let g:lsp_diagnostics_highlights_insert_mode_enabled = 1
let g:lsp_diagnostics_highlights_insert_mode_enabled = 0
g:lsp_diagnostics_highlights_delay *g:lsp_diagnostics_highlights_delay*
Type: |Number|
Default: `500`
Delay milliseconds to update diagnostics highlights. Requires
|g:lsp_diagnostics_highlights_enabled|.
Example: >
let g:lsp_diagnostics_highlights_delay = 200
let g:lsp_diagnostics_highlights_delay = 1000
g:lsp_diagnostics_signs_enabled
*g:lsp_diagnostics_signs_enabled*
Type: |Number|
Default: `1` for vim/neovim with patch 8.1.0772
Enables signs for diagnostics. Requires NeoVim with |sign_define| or Vim
with |sign_define| and patch 8.1.0772 or newer and
|g:lsp_diagnostics_enabled| set to `1`.
Example: >
let g:lsp_diagnostics_signs_enabled = 1
let g:lsp_diagnostics_signs_enabled = 0
<
Four groups of signs are defined and used:
`LspError`, `LspWarning`, `LspInformation`, `LspHint`.
It is possible to set custom text or icon that will be used for each sign
(note that icons are only available in GUI).
`LspError` defaults to `E>`.
`LspHint` defaults to `H>`.
`LspInformation` defaults to `I>`.
`LspWarning` defaults to `W>`.
To do this, set some of the following globals:
`g:lsp_diagnostics_signs_error`, `g:lsp_diagnostics_signs_warning`,
`g:lsp_diagnostics_signs_information`, `g:lsp_diagnostics_signs_hint`.
They should be set to a dict, that contains either text that will be used
as sign in terminal, or icon that will be used for GUI, or both.
Example: >
let g:lsp_diagnostics_signs_error = {'text': '✗'}
let g:lsp_diagnostics_signs_warning = {'text': '‼', 'icon': '/path/to/some/icon'} " icons require GUI
let g:lsp_diagnostics_signs_hint = {'icon': '/path/to/some/other/icon'} " icons require GUI
g:lsp_diagnostics_signs_insert_mode_enabled
*g:lsp_diagnostics_signs_insert_mode_enabled*
Type: |Number|
Default: `1`
Indicates whether to enable diagnostics signs column when in |insertmode|.
Requires |g:lsp_diagnostics_signs_enabled|.
Example: >
let g:lsp_diagnostics_signs_insert_mode_enabled = 1
let g:lsp_diagnostics_signs_insert_mode_enabled = 0
g:lsp_diagnostics_signs_delay *g:lsp_diagnostics_signs_delay*
Type: |Number|
Default: `500`
Delay milliseconds to update diagnostics signs column. Requires
|g:lsp_diagnostics_signs_enabled|.
Example: >
let g:lsp_diagnostics_signs_delay = 200
let g:lsp_diagnostics_signs_delay = 1000
g:lsp_diagnostics_signs_priority *g:lsp_diagnostics_signs_priority*
Type: |Number|
Default: `10`
Configures the |sign-priority| for placed signs. Signs placed by other
plugins have a priority of 10 by default. Requires
|g:lsp_diagnostics_signs_enabled| set to 1.
Example: >
let g:lsp_diagnostics_signs_priority = 11
let g:lsp_diagnostics_signs_priority = 9
g:lsp_diagnostics_signs_priority_map *g:lsp_diagnostics_signs_priority_map*
Type: |Dict|
Default: `{}`
Overrides |g:lsp_diagnostics_signs_priority| per severity level or per server
name and severity level. Requires |g:lsp_diagnostics_signs_enabled| set to 1.
Example: >
let g:lsp_diagnostics_signs_priority_map = {
\'LspError': 11,
\'LspWarning': 7,
\'clangd_LspWarning': 11,
\'clangd_LspInformation': 11
\}
g:lsp_diagnostics_virtual_text_enabled
*g:lsp_diagnostics_virtual_text_enabled*
Type: |Number|
Default: `1` for neovim 0.3+
Enables virtual text to be shown next to diagnostic errors. Requires
NeoVim with version 0.3 or newer or Vim with |virtual-text| and
patch 9.0.0178, and |g:lsp_diagnostics_enabled| set to `1`.
Virtual text uses the same highlight groups used for signs (eg LspErrorText),
but can be uniquely defined if you want to have different highlight groups
for signs and virtual text. To set unique virtual text highlighting, you
can set or link `LspErrorVirtualText`, `LspWarningVirtualText`,
`LspInformationVirtualText` and `LspHintVirtualText` highlight groups.
Example: >
let g:lsp_diagnostics_virtual_text_enabled = 1
let g:lsp_diagnostics_virtual_text_enabled = 0
g:lsp_diagnostics_virtual_text_insert_mode_enabled
*g:lsp_diagnostics_virtual_text_insert_mode_enabled*
Type: |Number|
Default: `0`
Indicates whether to enable diagnostics virtual text when in |insertmode|.
Requires |g:lsp_diagnostics_virtual_text_enabled|.
Example: >
let g:lsp_diagnostics_virtual_text_insert_mode_enabled = 1
let g:lsp_diagnostics_virtual_text_insert_mode_enabled = 0
g:lsp_diagnostics_virtual_text_delay *g:lsp_diagnostics_virtual_text_delay*
Type: |Number|
Default: `500`
Delay milliseconds to update diagnostics virtual text. Requires
|g:lsp_diagnostics_virtual_text_enabled|.
Example: >
let g:lsp_diagnostics_virtual_text_delay = 200
let g:lsp_diagnostics_virtual_text_delay = 1000
g:lsp_diagnostics_virtual_text_prefix *g:lsp_diagnostics_virtual_text_prefix*
Type: |String|
Default: `""`
Adds the prefix to the diagnostics to be shown as virtual text. Requires
|g:lsp_diagnostics_virtual_text_enabled|.
Example: >
let g:lsp_diagnostics_virtual_text_prefix = "> "
let g:lsp_diagnostics_virtual_text_prefix = " ‣ "
g:lsp_diagnostics_virtual_text_align *g:lsp_diagnostics_virtual_text_align*
Type: |String|
Default: `"below"`
Determines the align of the diagnostics virtual text. Requires
|g:lsp_diagnostics_virtual_text_enabled|.
Possible values are:
after after the end of the line
right right aligned in the window (unless the text wraps to the next
screen line)
below in the next screen line
above just above the line
Only one "right" property can fit in each line, if there are two or more
these will go in a separate line (still right aligned).
This value is passed as the "text_align" property in a |prop_add()| call.
Example: >
let g:lsp_diagnostics_virtual_text_align = "right"
g:lsp_diagnostics_virtual_text_padding_left
*g:lsp_diagnostics_virtual_text_padding_left*
Type: |Number|
Default: `1`
Determines the left padding of the diagnostics virtual text. Requires
|g:lsp_diagnostics_virtual_text_enabled|.
Example: >
let g:lsp_diagnostics_virtual_text_padding_left = 2
g:lsp_diagnostics_virtual_text_wrap *g:lsp_diagnostics_virtual_text_wrap*
Type: |String|
Default: `"wrap"`
Determines whether or not to wrap the diagnostics virtual text. Possible
values are one of `'wrap'`, `'truncate'`. Requires
|g:lsp_diagnostics_virtual_text_enabled|.
Example: >
let g:lsp_diagnostics_virtual_text_wrap = "truncate"
g:lsp_document_code_action_signs_enabled
*g:lsp_document_code_action_signs_enabled*
Type: |Number|
Default: `1`
Enables signs for code actions. Requires NeoVim with |sign_define| or Vim
with |sign_define| and patch 8.1.0772 or newer.
Example: >
let g:lsp_document_code_action_signs_enabled = 1
let g:lsp_document_code_action_signs_enabled = 0
<
`LspCodeActionText` sign is defined and used.
It is possible to set custom text or icon that will be used for sign
(note that icons are only available in GUI).
`LspCodeActionText` defaults to `A>`.
To do this, set the following globals:
`g:lsp_document_code_action_signs_hint`.
They should be set to a dict, that contains either text that will be used
as sign in terminal, or icon that will be used for GUI, or both.
Example: >
let g:lsp_document_code_action_signs_hint = {'text': 'A>'}
let g:lsp_document_code_action_signs_hint = {'text': '‼', 'icon': '/path/to/some/icon'} " icons require GUI
let g:lsp_document_code_action_signs_hint = {'icon': '/path/to/some/other/icon'} " icons require GUI
g:lsp_document_code_action_signs_delay
*g:lsp_document_code_action_signs_delay*
Type: |Number|
Default: `500`
Delay milliseconds to update code action signs. Requires
|g:lsp_document_code_action_signs_enabled|.
Example: >
let g:lsp_document_code_action_signs_delay = 200
let g:lsp_document_code_action_signs_delay = 1000
>
g:lsp_inlay_hints_enabled
*g:lsp_inlay_hints_enabled*
Type: |Number|
Default: `0`
Enables inlay-hints. Requires Vim9 with |virtual-text|.
patch 9.0.0167 or newer.
Example: >
let g:lsp_inlay_hints_enabled = 1
let g:lsp_inlay_hints_enabled = 0
<
To change the style of the inlay-hints, you can set or link the
`lspInlayHintsType` and `lspInlayHintsParameter` highlight group.
Example: >
highlight lspInlayHintsType ctermfg=red guifg=red
\ ctermbg=green guibg=green
highlight lspInlayHintsParameter ctermfg=red guifg=red
\ ctermbg=green guibg=green
g:lsp_inlay_hints_delay
*g:lsp_inlay_hints_delay*
Type: |Number|
Default: `350`
Delay milliseconds to update inlay-hints. Requires
|g:lsp_inlay_hints_enabled|.
Example: >
let g:lsp_inlay_hints_delay = 200
let g:lsp_inlay_hints_delay = 1000
>
g:lsp_inlay_hints_mode
*g:lsp_inlay_hints_mode*
Type: |Dict|
Default: `{}`
This mode currently only include "curline" and "!curline".
Example: >
let g:lsp_inlay_hints_mode = {
\ 'normal': ['curline'],
\}
<
"curline" show hint only for current line. "!curline" show hints except
current line. Default show all hints.
>
g:lsp_tree_incoming_prefix *g:lsp_tree_incoming_prefix*
Type: |String|
Default: `"<= "`
Specifies the prefix of items added by following commands.
* |LspAddTreeCallHierarchyIncoming|
* |LspAddTreeReferences|
Example: >
let g:lsp_tree_incoming_prefix = "← "
let g:lsp_tree_incoming_prefix = "⬅️ "
g:lsp_use_event_queue *g:lsp_use_event_queue*
Type: |Number|
Default: `1` for neovim or vim with patch-8.1.0889
Enable event queue which improves performance by reducing the
communication between client and server.
Example: >
let g:lsp_use_event_queue = 1
let g:lsp_use_event_queue = 0
g:lsp_max_buffer_size *g:lsp_max_buffer_size*
Type: |Number|
Default: `5000000`
To improve performance, if a buffer is larger than
`g:lsp_max_buffer_size` (measured in bytes), the following features
are disabled:
* Semantic highlighting
This functionality can be disabled by setting `g:lsp_max_buffer_size`
to a negative value.
Example: >
let g:lsp_max_buffer_size = 10000000
let g:lsp_max_buffer_size = -1
g:lsp_document_highlight_enabled *g:lsp_document_highlight_enabled*
Type: |Number|
Default: `1` for neovim or vim with patch-8.1.1035
Enables highlighting of the references to the symbol under the cursor.
Requires NeoVim with version 0.3 or Vim 8.1.1035 or newer.
Example: >
let g:lsp_document_highlight_enabled = 1
let g:lsp_document_highlight_enabled = 0
<
To change the style of the highlighting, you can set or link the
`lspReference` highlight group.
Example: >
highlight lspReference ctermfg=red guifg=red ctermbg=green guibg=green
g:lsp_document_highlight_delay *g:lsp_document_highlight_delay*
Type: |Number|
Default: `350`
Delay milliseconds to highlight references. Requires
|g:lsp_document_highlight_enabled| set to 1.
Example: >
let g:lsp_document_highlight_delay = 200
let g:lsp_document_highlight_delay = 1000
g:lsp_get_supported_capabilities *g:lsp_get_supported_capabilities*
Type: |List|
Default: `[function('lsp#default_get_supported_capabilities')]`
A |List| containing one element of type |Funcref|. This element is a
reference to the function that vim-lsp should use to obtain the supported
LSP capabilities. Changing this variable allows customizing which
capabilities vim-lsp sends to a language server.
Note: You can obtain the default supported capabilities of vim-lsp by
calling `lsp#default_get_supported_capabilities` from within your
function.
g:lsp_document_symbol_detail *g:lsp_document_symbol_detail*
Type: |Number|
Default: `0`
Determines whether document symbol shows details or not. Set to `1` to
show details.
Note: showing details needs to turn on setting below: >
\ 'capabilities': {
\ 'textDocument': {
\ 'documentSymbol': {
\ 'hierarchicalDocumentSymbolSupport': v:true,
\ },
\ },
\ },
g:lsp_peek_alignment *g:lsp_peek_alignment*
Type: |String|
Default: `"center"`
Determines how to align the location of interest for e.g.
|:LspPeekDefinition|. Three values are possible: `"top"`, `"center"` and
`"bottom"`, which place the location of interest at the first, middle and
last lines of the preview/popup/floating window, respectively.
g:lsp_preview_max_width *g:lsp_preview_max_width*
Type: |Number|
Default: `-1`
If positive, determines the maximum width of the preview window in
characters. Lines longer than `g:lsp_preview_max_width` will be wrapped to
fit in the preview window. Use a value of `-1` to disable setting a
maximum width.
g:lsp_preview_max_height *g:lsp_preview_max_height*
Type: |Number|
Default: `-1`
If positive, determines the maximum height of the preview window in
characters. Use a value of `-1` to disable setting a maximum height.
g:lsp_preview_fixup_conceal *g:lsp_preview_fixup_conceal*
Type: |Number|