diff options
-rw-r--r-- | settings/eclipse-jdt-ls.vim | 12 | ||||
-rw-r--r-- | settings/rust-analyzer.vim | 13 |
2 files changed, 21 insertions, 4 deletions
diff --git a/settings/eclipse-jdt-ls.vim b/settings/eclipse-jdt-ls.vim index 987fd79..2fbaf02 100644 --- a/settings/eclipse-jdt-ls.vim +++ b/settings/eclipse-jdt-ls.vim @@ -11,11 +11,19 @@ augroup vimlsp_settings_eclipse_jdt_ls \ 'workspace_config': lsp_settings#get('eclipse-jdt-ls', 'workspace_config', {}), \ 'semantic_highlight': lsp_settings#get('eclipse-jdt-ls', 'semantic_highlight', {}), \ } + autocmd User lsp_setup call s:register_command() augroup END function! s:eclipse_jdt_ls_java_apply_workspaceEdit(context) let l:command = get(a:context, 'command', {}) - call lsp#utils#workspace_edit#apply_workspace_edit(l:command['arguments'][0]) endfunction -call lsp#register_command('java.apply.workspaceEdit', function('s:eclipse_jdt_ls_java_apply_workspaceEdit')) + +function! s:register_command() + augroup vimlsp_settings_eclipse_jdt_ls + au! + augroup END + if exists('*lsp#register_command') + call lsp#register_command('java.apply.workspaceEdit', function('s:eclipse_jdt_ls_java_apply_workspaceEdit')) + endif +endfunction diff --git a/settings/rust-analyzer.vim b/settings/rust-analyzer.vim index b0f25ce..14dd9d9 100644 --- a/settings/rust-analyzer.vim +++ b/settings/rust-analyzer.vim @@ -1,4 +1,4 @@ -augroup vimlsp_settings_rust-analyzer +augroup vimlsp_settings_rust_analyzer au! LspRegisterServer { \ 'name': 'rust-analyzer', @@ -11,6 +11,7 @@ augroup vimlsp_settings_rust-analyzer \ 'workspace_config': lsp_settings#get('rust-analyzer', 'workspace_config', {}), \ 'semantic_highlight': lsp_settings#get('rust-analyzer', 'semantic_highlight', {}), \ } + autocmd User lsp_setup call s:register_command() augroup END function! s:rust_analyzer_apply_source_change(context) @@ -26,4 +27,12 @@ function! s:rust_analyzer_apply_source_change(context) call cursor(lsp#utils#position#_lsp_to_vim('%', l:cursor_position)) endif endfunction -call lsp#register_command('rust-analyzer.applySourceChange', function('s:rust_analyzer_apply_source_change')) + +function! s:register_command() + augroup vimlsp_settings_rust_analyzer + au! + augroup END + if exists('*lsp#register_command') + call lsp#register_command('rust-analyzer.applySourceChange', function('s:rust_analyzer_apply_source_change')) + endif +endfunction |