1
1
let s: undo_configure_key = ' undo_lsp_configure_buffer'
2
2
3
- function ! lsp#ConfigureBuffer (client_capabilities ) abort
3
+ function ! lsp#ConfigureBuffer (capabilities ) abort
4
4
nnoremap <buffer> <silent> gD :lua vim.lsp.buf.declaration()<CR>
5
5
let b: [s: undo_configure_key ] = ' | silent! nunmap <buffer> gD'
6
6
@@ -25,19 +25,19 @@ function! lsp#ConfigureBuffer(client_capabilities) abort
25
25
setlocal tagfunc = v: lua .vim .lsp .tagfunc
26
26
let b: [s: undo_configure_key ] .= ' | setlocal tagfunc<'
27
27
28
- if a: client_capabilities .completion
28
+ if has_key ( a: capabilities , " completionProvider " )
29
29
setlocal omnifunc = v: lua .vim .lsp .omnifunc
30
30
let b: [s: undo_configure_key ] .= ' | setlocal omnifunc<'
31
31
endif
32
32
33
- if a: client_capabilities .document_formatting
34
- autocmd BufWritePre <buffer> lua vim .lsp .buf .formatting_sync ()
33
+ if has_key ( a: capabilities , " documentFormattingProvider " )
34
+ autocmd BufWritePre <buffer> lua vim .lsp .buf .format ()
35
35
let b: [s: undo_configure_key ] .= ' | autocmd! BufWritePre <buffer>'
36
36
endif
37
37
38
38
let l: code_actions = []
39
- if type (a: client_capabilities .code_action) == v: t_dict
40
- let l: code_actions = get (a: client_capabilities .code_action , ' codeActionKinds' , [])
39
+ if has_key (a: capabilities , " codeActionProvider " )
40
+ let l: code_actions = get (a: capabilities .codeActionProvider , ' codeActionKinds' , [])
41
41
endif
42
42
43
43
if match (l: code_actions , ' source.organizeImports' ) != -1
0 commit comments