diff options
-rw-r--r-- | settings/eclipse-jdt-ls.vim | 7 | ||||
-rw-r--r-- | settings/rust-analyzer.vim | 15 |
2 files changed, 22 insertions, 0 deletions
diff --git a/settings/eclipse-jdt-ls.vim b/settings/eclipse-jdt-ls.vim index 1307b0e..987fd79 100644 --- a/settings/eclipse-jdt-ls.vim +++ b/settings/eclipse-jdt-ls.vim @@ -12,3 +12,10 @@ augroup vimlsp_settings_eclipse_jdt_ls \ 'semantic_highlight': lsp_settings#get('eclipse-jdt-ls', 'semantic_highlight', {}), \ } 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')) diff --git a/settings/rust-analyzer.vim b/settings/rust-analyzer.vim index 993add9..b0f25ce 100644 --- a/settings/rust-analyzer.vim +++ b/settings/rust-analyzer.vim @@ -12,3 +12,18 @@ augroup vimlsp_settings_rust-analyzer \ 'semantic_highlight': lsp_settings#get('rust-analyzer', 'semantic_highlight', {}), \ } augroup END + +function! s:rust_analyzer_apply_source_change(context) + let l:command = get(a:context, 'command', {}) + + let l:workspace_edit = get(l:command['arguments'][0], 'workspaceEdit', {}) + if !empty(l:workspace_edit) + call lsp#utils#workspace_edit#apply_workspace_edit(l:workspace_edit) + endif + + let l:cursor_position = get(l:command['arguments'][0], 'cursorPosition', {}) + if !empty(l:cursor_position) + 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')) |