]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/vim-lsp/autoload/lsp/utils/workspace_edit.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '56df844d3c39ec494dacc69eae34272b27db185a' as '.vim/bundle/asyncomplete'
[etc/vim.git] / .vim / bundle / vim-lsp / autoload / lsp / utils / workspace_edit.vim
1 " Applies WorkspaceEdit changes.
2 function! lsp#utils#workspace_edit#apply_workspace_edit(workspace_edit) abort
3     let l:loclist_items = []
4
5     if has_key(a:workspace_edit, 'documentChanges')
6         for l:text_document_edit in a:workspace_edit['documentChanges']
7             let l:loclist_items += s:_apply(l:text_document_edit['textDocument']['uri'], l:text_document_edit['edits'])
8         endfor
9     elseif has_key(a:workspace_edit, 'changes')
10         for [l:uri, l:text_edits] in items(a:workspace_edit['changes'])
11             let l:loclist_items += s:_apply(l:uri, l:text_edits)
12         endfor
13     endif
14
15     if g:lsp_show_workspace_edits
16         call setloclist(0, l:loclist_items, 'r')
17         execute 'lopen'
18     endif
19 endfunction
20
21 "
22 " _apply
23 "
24 function! s:_apply(uri, text_edits) abort
25     call lsp#utils#text_edit#apply_text_edits(a:uri, a:text_edits)
26     return lsp#utils#text_edit#_lsp_to_vim_list(a:uri, a:text_edits)
27 endfunction