From b93a7cf76b01219ab3e5ea58623f7f3afdfc7dc6 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Mon, 2 Mar 2020 09:30:46 +0900 Subject: Fix for review --- settings/rust-analyzer.vim | 9 ++++++--- 1 file 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 -- cgit v1.2.3-54-g00ecf