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 if exists('g:lsp_loaded') || !exists('*json_encode') || !has('timers') || !has('lambda')
6 let g:lsp_use_lua = get(g:, 'lsp_use_lua', has('nvim-0.4.0') || (has('lua') && has('patch-8.2.0775')))
7 let g:lsp_use_native_client = get(g:, 'lsp_use_native_client', 0)
8 let g:lsp_auto_enable = get(g:, 'lsp_auto_enable', 1)
9 let g:lsp_async_completion = get(g:, 'lsp_async_completion', 0)
10 let g:lsp_log_file = get(g:, 'lsp_log_file', '')
11 let g:lsp_log_verbose = get(g:, 'lsp_log_verbose', 1)
12 let g:lsp_debug_servers = get(g:, 'lsp_debug_servers', [])
13 let g:lsp_format_sync_timeout = get(g:, 'lsp_format_sync_timeout', -1)
14 let g:lsp_max_buffer_size = get(g:, 'lsp_max_buffer_size', 5000000)
16 let g:lsp_completion_documentation_enabled = get(g:, 'lsp_completion_documentation_enabled', 1)
17 let g:lsp_completion_documentation_delay = get(g:, 'lsp_completion_documention_delay', 80)
19 let g:lsp_diagnostics_enabled = get(g:, 'lsp_diagnostics_enabled', 1)
20 let g:lsp_diagnostics_echo_cursor = get(g:, 'lsp_diagnostics_echo_cursor', 0)
21 let g:lsp_diagnostics_echo_delay = get(g:, 'lsp_diagnostics_echo_delay', 500)
22 let g:lsp_diagnostics_float_cursor = get(g:, 'lsp_diagnostics_float_cursor', 0)
23 let g:lsp_diagnostics_float_delay = get(g:, 'lsp_diagnostics_float_delay', 500)
24 let g:lsp_diagnostics_float_insert_mode_enabled = get(g:, 'lsp_diagnostics_float_insert_mode_enabled', 1)
25 let g:lsp_diagnostics_highlights_enabled = get(g:, 'lsp_diagnostics_highlights_enabled', lsp#utils#_has_highlights())
26 let g:lsp_diagnostics_highlights_insert_mode_enabled = get(g:, 'lsp_diagnostics_highlights_insert_mode_enabled', 1)
27 let g:lsp_diagnostics_highlights_delay = get(g:, 'lsp_diagnostics_highlights_delay', 500)
28 let g:lsp_diagnostics_signs_enabled = get(g:, 'lsp_diagnostics_signs_enabled', lsp#utils#_has_signs())
29 let g:lsp_diagnostics_signs_insert_mode_enabled = get(g:, 'lsp_diagnostics_signs_insert_mode_enabled', 1)
30 let g:lsp_diagnostics_signs_delay = get(g:, 'lsp_diagnostics_signs_delay', 500)
31 let g:lsp_diagnostics_signs_error = get(g:, 'lsp_diagnostics_signs_error', {})
32 let g:lsp_diagnostics_signs_warning = get(g:, 'lsp_diagnostics_signs_warning', {})
33 let g:lsp_diagnostics_signs_information = get(g:, 'lsp_diagnostics_signs_information', {})
34 let g:lsp_diagnostics_signs_hint = get(g:, 'lsp_diagnostics_signs_hint', {})
35 let g:lsp_diagnostics_signs_priority = get(g:, 'lsp_diagnostics_signs_priority', 10)
36 let g:lsp_diagnostics_signs_priority_map = get(g:, 'lsp_diagnostics_signs_priority_map', {})
37 let g:lsp_diagnostics_virtual_text_enabled = get(g:, 'lsp_diagnostics_virtual_text_enabled', lsp#utils#_has_nvim_virtual_text() || lsp#utils#_has_vim_virtual_text())
38 let g:lsp_diagnostics_virtual_text_insert_mode_enabled = get(g:, 'lsp_diagnostics_virtual_text_insert_mode_enabled', 0)
39 let g:lsp_diagnostics_virtual_text_delay = get(g:, 'lsp_diagnostics_virtual_text_delay', 500)
40 let g:lsp_diagnostics_virtual_text_prefix = get(g:, 'lsp_diagnostics_virtual_text_prefix', '')
41 let g:lsp_diagnostics_virtual_text_align = get(g:, 'lsp_diagnostics_virtual_text_align', 'below')
42 let g:lsp_diagnostics_virtual_text_wrap = get(g:, 'lsp_diagnostics_virtual_text_wrap', 'wrap')
43 let g:lsp_diagnostics_virtual_text_padding_left = get(g:, 'lsp_diagnostics_virtual_text_padding_left', 1)
45 let g:lsp_document_code_action_signs_enabled = get(g:, 'lsp_document_code_action_signs_enabled', 1)
46 let g:lsp_document_code_action_signs_delay = get(g:, 'lsp_document_code_action_signs_delay', 500)
47 let g:lsp_document_code_action_signs_hint = get(g:, 'lsp_document_code_action_signs_hint', {})
48 let g:lsp_document_code_action_signs_priority = get(g:, 'lsp_document_code_action_signs_priority', 10)
50 let g:lsp_tree_incoming_prefix = get(g:, 'lsp_tree_incoming_prefix', '<= ')
52 let g:lsp_preview_keep_focus = get(g:, 'lsp_preview_keep_focus', 1)
53 let g:lsp_use_event_queue = get(g:, 'lsp_use_event_queue', has('nvim') || has('patch-8.1.0889'))
54 let g:lsp_insert_text_enabled= get(g:, 'lsp_insert_text_enabled', 1)
55 let g:lsp_text_edit_enabled = get(g:, 'lsp_text_edit_enabled', has('patch-8.0.1493'))
56 let g:lsp_document_highlight_enabled = get(g:, 'lsp_document_highlight_enabled', 1)
57 let g:lsp_document_highlight_delay = get(g:, 'lsp_document_highlight_delay', 350)
58 let g:lsp_preview_float = get(g:, 'lsp_preview_float', 1)
59 let g:lsp_preview_autoclose = get(g:, 'lsp_preview_autoclose', 1)
60 let g:lsp_preview_doubletap = get(g:, 'lsp_preview_doubletap', [function('lsp#ui#vim#output#focuspreview')])
61 let g:lsp_preview_fixup_conceal = get(g:, 'lsp_preview_fixup_conceal', 0)
62 let g:lsp_peek_alignment = get(g:, 'lsp_peek_alignment', 'center')
63 let g:lsp_preview_max_width = get(g:, 'lsp_preview_max_width', -1)
64 let g:lsp_preview_max_height = get(g:, 'lsp_preview_max_height', -1)
65 let g:lsp_float_max_width = get(g:, 'lsp_float_max_width', -1)
66 let g:lsp_signature_help_enabled = get(g:, 'lsp_signature_help_enabled', 1)
67 let g:lsp_signature_help_delay = get(g:, 'lsp_signature_help_delay', 200)
68 let g:lsp_show_workspace_edits = get(g:, 'lsp_show_workspace_edits', 0)
69 let g:lsp_fold_enabled = get(g:, 'lsp_fold_enabled', 1)
70 let g:lsp_hover_conceal = get(g:, 'lsp_hover_conceal', 1)
71 let g:lsp_hover_ui = get(g:, 'lsp_hover_ui', '')
72 let g:lsp_ignorecase = get(g:, 'lsp_ignorecase', &ignorecase)
73 let g:lsp_semantic_enabled = get(g:, 'lsp_semantic_enabled', 0)
74 let g:lsp_semantic_delay = get(g:, 'lsp_semantic_delay', 500)
75 let g:lsp_text_document_did_save_delay = get(g:, 'lsp_text_document_did_save_delay', -1)
76 let g:lsp_completion_resolve_timeout = get(g:, 'lsp_completion_resolve_timeout', 200)
77 let g:lsp_tagfunc_source_methods = get(g:, 'lsp_tagfunc_source_methods', ['definition', 'declaration', 'implementation', 'typeDefinition'])
78 let g:lsp_show_message_request_enabled = get(g:, 'lsp_show_message_request_enabled', 1)
79 let g:lsp_show_message_log_level = get(g:, 'lsp_show_message_log_level', 'warning')
80 let g:lsp_work_done_progress_enabled = get(g:, 'lsp_work_done_progress_enabled', 0)
81 let g:lsp_untitled_buffer_enabled = get(g:, 'lsp_untitled_buffer_enabled', 1)
82 let g:lsp_inlay_hints_enabled = get(g:, 'lsp_inlay_hints_enabled', 0)
83 let g:lsp_inlay_hints_delay = get(g:, 'lsp_inlay_hints_delay', 350)
84 let g:lsp_code_action_ui = get(g:, 'lsp_code_action_ui', 'preview')
86 let g:lsp_get_supported_capabilities = get(g:, 'lsp_get_supported_capabilities', [function('lsp#default_get_supported_capabilities')])
88 let g:lsp_document_symbol_detail = get(g:, 'lsp_document_symbol_detail', 0)
90 let g:lsp_experimental_workspace_folders = get(g:, 'lsp_experimental_workspace_folders', 0)
93 augroup lsp_auto_enable
95 autocmd VimEnter * call lsp#enable()
99 command! LspAddTreeCallHierarchyIncoming call lsp#ui#vim#add_tree_call_hierarchy_incoming()
100 command! LspCallHierarchyIncoming call lsp#ui#vim#call_hierarchy_incoming({})
101 command! LspCallHierarchyOutgoing call lsp#ui#vim#call_hierarchy_outgoing()
102 command! -range -nargs=* -complete=customlist,lsp#ui#vim#code_action#complete LspCodeAction call lsp#ui#vim#code_action#do(
103 \ extend({ 'sync': v:false, 'selection': <range> != 0 }, lsp#utils#args#_parse(<q-args>, {
104 \ 'ui': { 'type': type('') },
106 command! -range -nargs=* -complete=customlist,lsp#ui#vim#code_action#complete LspCodeActionSync call lsp#ui#vim#code_action#do(
107 \ extend({ 'sync': v:true, 'selection': <range> != 0 }, lsp#utils#args#_parse(<q-args>, {
108 \ 'ui': { 'type': type('') },
110 command! LspCodeLens call lsp#ui#vim#code_lens#do({})
111 command! LspDeclaration call lsp#ui#vim#declaration(0, <q-mods>)
112 command! LspPeekDeclaration call lsp#ui#vim#declaration(1)
113 command! LspDefinition call lsp#ui#vim#definition(0, <q-mods>)
114 command! LspPeekDefinition call lsp#ui#vim#definition(1)
115 command! LspDocumentSymbol call lsp#ui#vim#document_symbol()
116 command! LspDocumentSymbolSearch call lsp#internal#document_symbol#search#do({})
117 command! -nargs=? LspDocumentDiagnostics call lsp#internal#diagnostics#document_diagnostics_command#do(
118 \ extend({}, lsp#utils#args#_parse(<q-args>, {
119 \ 'buffers': {'type': type('')},
121 command! -nargs=? -complete=customlist,lsp#utils#empty_complete LspHover call lsp#internal#document_hover#under_cursor#do(
122 \ extend({}, lsp#utils#args#_parse(<q-args>, {
123 \ 'ui': { 'type': type('') },
125 command! -nargs=* LspNextError call lsp#internal#diagnostics#movement#_next_error(<f-args>)
126 command! -nargs=* LspPreviousError call lsp#internal#diagnostics#movement#_previous_error(<f-args>)
127 command! -nargs=* LspNextWarning call lsp#internal#diagnostics#movement#_next_warning(<f-args>)
128 command! -nargs=* LspPreviousWarning call lsp#internal#diagnostics#movement#_previous_warning(<f-args>)
129 command! -nargs=* LspNextDiagnostic call lsp#internal#diagnostics#movement#_next_diagnostics(<f-args>)
130 command! -nargs=* LspPreviousDiagnostic call lsp#internal#diagnostics#movement#_previous_diagnostics(<f-args>)
131 command! LspReferences call lsp#ui#vim#references({})
132 command! LspAddTreeReferences call lsp#ui#vim#add_tree_references()
133 command! LspRename call lsp#ui#vim#rename()
134 command! LspTypeDefinition call lsp#ui#vim#type_definition(0, <q-mods>)
135 command! LspTypeHierarchy call lsp#internal#type_hierarchy#show()
136 command! LspPeekTypeDefinition call lsp#ui#vim#type_definition(1)
137 command! -nargs=? LspWorkspaceSymbol call lsp#ui#vim#workspace_symbol(<q-args>)
138 command! -nargs=? LspWorkspaceSymbolSearch call lsp#internal#workspace_symbol#search#do({'query': <q-args>})
139 command! -range LspDocumentFormat call lsp#internal#document_formatting#format({ 'bufnr': bufnr('%') })
140 command! -range -nargs=? LspDocumentFormatSync call lsp#internal#document_formatting#format(
141 \ extend({'bufnr': bufnr('%'), 'sync': 1 }, lsp#utils#args#_parse(<q-args>, {
142 \ 'timeout': {'type': type(0)},
143 \ 'sleep': {'type': type(0)},
145 command! -range LspDocumentRangeFormat call lsp#internal#document_range_formatting#format({ 'bufnr': bufnr('%') })
146 command! -range -nargs=? LspDocumentRangeFormatSync call lsp#internal#document_range_formatting#format(
147 \ extend({'bufnr': bufnr('%'), 'sync': 1 }, lsp#utils#args#_parse(<q-args>, {
148 \ 'timeout': {'type': type(0)},
149 \ 'sleep': {'type': type(0)},
151 command! LspImplementation call lsp#ui#vim#implementation(0, <q-mods>)
152 command! LspPeekImplementation call lsp#ui#vim#implementation(1)
153 command! -nargs=0 LspStatus call lsp#print_server_status()
154 command! LspNextReference call lsp#internal#document_highlight#jump(+1)
155 command! LspPreviousReference call lsp#internal#document_highlight#jump(-1)
156 command! -nargs=? -bang -complete=customlist,lsp#server_complete_running LspStopServer call lsp#ui#vim#stop_server("<bang>", <f-args>)
157 command! -nargs=? -complete=customlist,lsp#utils#empty_complete LspSignatureHelp call lsp#ui#vim#signature_help#get_signature_help_under_cursor()
158 command! LspDocumentFold call lsp#ui#vim#folding#fold(0)
159 command! LspDocumentFoldSync call lsp#ui#vim#folding#fold(1)
160 command! -nargs=0 LspSemanticTokenTypes echo lsp#internal#semantic#get_token_types()
161 command! -nargs=0 LspSemanticTokenModifiers echo lsp#internal#semantic#get_token_modifiers()
163 nnoremap <silent> <plug>(lsp-call-hierarchy-incoming) :<c-u>call lsp#ui#vim#call_hierarchy_incoming({})<cr>
164 nnoremap <silent> <plug>(lsp-call-hierarchy-outgoing) :<c-u>call lsp#ui#vim#call_hierarchy_outgoing()<cr>
165 nnoremap <silent> <plug>(lsp-code-action) :<c-u>call lsp#ui#vim#code_action({})<cr>
166 nnoremap <silent> <plug>(lsp-code-action-float) :<c-u>call lsp#ui#vim#code_action({ 'ui': 'float' })<cr>
167 nnoremap <silent> <plug>(lsp-code-action-preview) :<c-u>call lsp#ui#vim#code_action({ 'ui': 'preview' })<cr>
168 nnoremap <silent> <plug>(lsp-code-lens) :<c-u>call lsp#ui#vim#code_lens()<cr>
169 nnoremap <silent> <plug>(lsp-declaration) :<c-u>call lsp#ui#vim#declaration(0)<cr>
170 nnoremap <silent> <plug>(lsp-peek-declaration) :<c-u>call lsp#ui#vim#declaration(1)<cr>
171 nnoremap <silent> <plug>(lsp-definition) :<c-u>call lsp#ui#vim#definition(0)<cr>
172 nnoremap <silent> <plug>(lsp-peek-definition) :<c-u>call lsp#ui#vim#definition(1)<cr>
173 nnoremap <silent> <plug>(lsp-document-symbol) :<c-u>call lsp#ui#vim#document_symbol()<cr>
174 nnoremap <silent> <plug>(lsp-document-symbol-search) :<c-u>call lsp#internal#document_symbol#search#do({})<cr>
175 nnoremap <silent> <plug>(lsp-document-diagnostics) :<c-u>call lsp#internal#diagnostics#document_diagnostics_command#do({})<cr>
176 nnoremap <silent> <plug>(lsp-hover) :<c-u>call lsp#internal#document_hover#under_cursor#do({})<cr>
177 nnoremap <silent> <plug>(lsp-hover-float) :<c-u>call lsp#internal#document_hover#under_cursor#do({ 'ui': 'float' })<cr>
178 nnoremap <silent> <plug>(lsp-hover-preview) :<c-u>call lsp#internal#document_hover#under_cursor#do({ 'ui': 'preview' })<cr>
179 nnoremap <silent> <plug>(lsp-preview-close) :<c-u>call lsp#ui#vim#output#closepreview()<cr>
180 nnoremap <silent> <plug>(lsp-preview-focus) :<c-u>call lsp#ui#vim#output#focuspreview()<cr>
181 nnoremap <silent> <plug>(lsp-next-error) :<c-u>call lsp#internal#diagnostics#movement#_next_error()<cr>
182 nnoremap <silent> <plug>(lsp-next-error-nowrap) :<c-u>call lsp#internal#diagnostics#movement#_next_error("-wrap=0")<cr>
183 nnoremap <silent> <plug>(lsp-previous-error) :<c-u>call lsp#internal#diagnostics#movement#_previous_error()<cr>
184 nnoremap <silent> <plug>(lsp-previous-error-nowrap) :<c-u>call lsp#internal#diagnostics#movement#_previous_error("-wrap=0")<cr>
185 nnoremap <silent> <plug>(lsp-next-warning) :<c-u>call lsp#internal#diagnostics#movement#_next_warning()<cr>
186 nnoremap <silent> <plug>(lsp-next-warning-nowrap) :<c-u>call lsp#internal#diagnostics#movement#_next_warning("-wrap=0")<cr>
187 nnoremap <silent> <plug>(lsp-previous-warning) :<c-u>call lsp#internal#diagnostics#movement#_previous_warning()<cr>
188 nnoremap <silent> <plug>(lsp-previous-warning-nowrap) :<c-u>call lsp#internal#diagnostics#movement#_previous_warning("-wrap=0")<cr>
189 nnoremap <silent> <plug>(lsp-next-diagnostic) :<c-u>call lsp#internal#diagnostics#movement#_next_diagnostics()<cr>
190 nnoremap <silent> <plug>(lsp-next-diagnostic-nowrap) :<c-u>call lsp#internal#diagnostics#movement#_next_diagnostics("-wrap=0")<cr>
191 nnoremap <silent> <plug>(lsp-previous-diagnostic) :<c-u>call lsp#internal#diagnostics#movement#_previous_diagnostics()<cr>
192 nnoremap <silent> <plug>(lsp-previous-diagnostic-nowrap) :<c-u>call lsp#internal#diagnostics#movement#_previous_diagnostics("-wrap=0")<cr>
193 nnoremap <silent> <plug>(lsp-references) :<c-u>call lsp#ui#vim#references({})<cr>
194 nnoremap <silent> <plug>(lsp-rename) :<c-u>call lsp#ui#vim#rename()<cr>
195 nnoremap <silent> <plug>(lsp-type-definition) :<c-u>call lsp#ui#vim#type_definition(0)<cr>
196 nnoremap <silent> <plug>(lsp-type-hierarchy) :<c-u>call lsp#internal#type_hierarchy#show()<cr>
197 nnoremap <silent> <plug>(lsp-peek-type-definition) :<c-u>call lsp#ui#vim#type_definition(1)<cr>
198 nnoremap <silent> <plug>(lsp-workspace-symbol) :<c-u>call lsp#ui#vim#workspace_symbol('')<cr>
199 nnoremap <silent> <plug>(lsp-workspace-symbol-search) :<c-u>call lsp#internal#workspace_symbol#search#do({})<cr>
200 nnoremap <silent> <plug>(lsp-document-format) :<c-u>call lsp#internal#document_formatting#format({ 'bufnr': bufnr('%') })<cr>
201 vnoremap <silent> <plug>(lsp-document-format) :<Home>silent <End>call lsp#internal#document_range_formatting#format({ 'bufnr': bufnr('%') })<cr>
202 nnoremap <silent> <plug>(lsp-document-range-format) :<c-u>set opfunc=lsp#internal#document_range_formatting#opfunc<cr>g@
203 xnoremap <silent> <plug>(lsp-document-range-format) :<Home>silent <End>call lsp#internal#document_range_formatting#format({ 'bufnr': bufnr('%') })<cr>
204 nnoremap <silent> <plug>(lsp-implementation) :<c-u>call lsp#ui#vim#implementation(0)<cr>
205 nnoremap <silent> <plug>(lsp-peek-implementation) :<c-u>call lsp#ui#vim#implementation(1)<cr>
206 nnoremap <silent> <plug>(lsp-status) :<c-u>echo lsp#get_server_status()<cr>
207 nnoremap <silent> <plug>(lsp-next-reference) :<c-u>call lsp#internal#document_highlight#jump(+1)<cr>
208 nnoremap <silent> <plug>(lsp-previous-reference) :<c-u>call lsp#internal#document_highlight#jump(-1)<cr>
209 nnoremap <silent> <plug>(lsp-signature-help) :<c-u>call lsp#ui#vim#signature_help#get_signature_help_under_cursor()<cr>
211 if has('gui_running')
212 anoremenu <silent> L&sp.Goto.Definition :LspDefinition<CR>
213 anoremenu <silent> L&sp.Goto.Declaration :LspDeclaration<CR>
214 anoremenu <silent> L&sp.Goto.Implementation :LspImplementation<CR>
215 anoremenu <silent> L&sp.Goto.TypeDef :LspTypeDefinition<CR>
217 anoremenu <silent> L&sp.Show\ Signature :LspShowSignature<CR>
218 anoremenu <silent> L&sp.Show\ References :LspReferences<CR>
219 anoremenu <silent> L&sp.Show\ Detail :LspHover<CR>
221 anoremenu <silent> L&sp.Symbol\ Search :LspDocumentSymbolSearch<CR>
222 anoremenu <silent> L&sp.Outgoing\ Calls :LspCallHierarchyOutgoing<CR>
223 anoremenu <silent> L&sp.Incoming\ Calls :LspCallHierarchyIncoming<CR>
224 anoremenu <silent> L&sp.Rename :LspRename<CR>
225 anoremenu <silent> L&sp.Code\ Action :LspCodeAction<CR>
227 anoremenu <silent> L&sp.Diagnostics.Next :LspNextDiagnostic<CR>
228 anoremenu <silent> L&sp.Diagnostics.Prev :LspPrevDiagnostic<CR>
230 if &mousemodel =~? 'popup'
231 anoremenu <silent> PopUp.L&sp.Go\ to\ Definition
233 anoremenu <silent> PopUp.L&sp.Go\ to\ Declaration
234 \ :LspDeclaration<CR>
235 anoremenu <silent> PopUp.L&sp.Find\ All\ References
237 anoremenu <silent> PopUp.L&sp.Show\ Detail