aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--settings/rust-analyzer.vim9
1 files changed, 6 insertions, 3 deletions
diff --git a/settings/rust-analyzer.vim b/settings/rust-analyzer.vim
index 14dd9d9..223b4d9 100644
--- a/settings/rust-analyzer.vim
+++ b/settings/rust-analyzer.vim
@@ -17,14 +17,17 @@ 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', {})
+ let l:arguments = get(l:command, 'arguments', [])
+ let l:argument = get(l:arguments, 0, {})
+
+ let l:workspace_edit = get(l:argument, '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', {})
+ let l:cursor_position = get(l:argument, 'cursorPosition', {})
if !empty(l:cursor_position)
- call cursor(lsp#utils#position#_lsp_to_vim('%', l:cursor_position))
+ call cursor(lsp#utils#position#lsp_to_vim('%', l:cursor_position))
endif
endfunction