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

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 'a39f715c13be3352193ffd9c5b7536b8786eff64' as '.vim/bundle/vim-lsp'
[etc/vim.git] / .vim / bundle / vim-lsp / test / lsp / utils / workspace_edit.vimspec
1 Describe lsp#utils#workspace_edit
2
3     Describe lsp#utils#text_edit#apply_workspace_edit
4         It populates location list with changes
5             let g:lsp_show_workspace_edits = 1
6
7             call lsp#utils#workspace_edit#apply_workspace_edit({
8                 \ 'documentChanges': [{
9                 \     'textDocument': { 'uri': 'file:///path/to/file' },
10                 \     'edits': [
11                 \         {
12                 \           "range": {
13                 \             "start": {
14                 \               "character": 0,
15                 \               "line": 1
16                 \             },
17                 \             "end": {
18                 \               "character": 0,
19                 \               "line": 1
20                 \             }
21                 \           },
22                 \           "newText": "import java.util.LinkedList;"
23                 \         },
24                 \         {
25                 \           "range": {
26                 \             "start": {
27                 \               "character": 0,
28                 \               "line": 0
29                 \             },
30                 \             "end": {
31                 \               "character": 0,
32                 \               "line": 0
33                 \             }
34                 \           },
35                 \           "newText": "import java.util.ArrayList;"
36                 \         }
37                 \     ]
38                 \ }]})
39
40             let l:loclist = getloclist(0)
41
42             Assert Equals(len(l:loclist), 2)
43
44             Assert Equals(l:loclist[0]['lnum'], 2)
45             Assert Equals(l:loclist[0]['col'], 1)
46             Assert Equals(l:loclist[0]['text'], 'import java.util.LinkedList;')
47
48             Assert Equals(l:loclist[1]['lnum'], 1)
49             Assert Equals(l:loclist[1]['col'], 1)
50             Assert Equals(l:loclist[1]['text'], 'import java.util.ArrayList;')
51
52         end
53
54         It should not set location list if not enabled
55             let g:lsp_show_workspace_edits = 0
56
57             call lsp#utils#workspace_edit#apply_workspace_edit({
58                 \ 'documentChanges': [{
59                 \     'textDocument': { 'uri': 'file:///path/to/file' },
60                 \     'edits': [
61                 \         {
62                 \           "range": {
63                 \             "start": {
64                 \               "character": 0,
65                 \               "line": 3
66                 \             },
67                 \             "end": {
68                 \               "character": 0,
69                 \               "line": 3
70                 \             }
71                 \           },
72                 \           "newText": "import java.util.LinkedList;"
73                 \         }
74                 \     ]
75                 \ }]})
76
77             Assert Equals(len(getloclist(0)), 0)
78         End
79     End
80 End
81