Files
vim-lsp-mirror/autoload/lsp/utils/workspace_edit.vim
hrsh7th 4d8cd302bb Follow vscode textEdit behavior (#764)
* Follo vscode textEdit behavior

* Remove unnecessary cursor position fixing
2020-03-25 00:56:27 +09:00

13 lines
612 B
VimL

" Applies WorkspaceEdit changes.
function! lsp#utils#workspace_edit#apply_workspace_edit(workspace_edit) abort
if has_key(a:workspace_edit, 'documentChanges')
for l:text_document_edit in a:workspace_edit['documentChanges']
call lsp#utils#text_edit#apply_text_edits(l:text_document_edit['textDocument']['uri'], l:text_document_edit['edits'])
endfor
elseif has_key(a:workspace_edit, 'changes')
for [l:uri, l:text_edits] in items(a:workspace_edit['changes'])
call lsp#utils#text_edit#apply_text_edits(l:uri, l:text_edits)
endfor
endif
endfunction