summaryrefslogtreecommitdiff
path: root/test/completion
diff options
context:
space:
mode:
authorJerko Steiner <jerko.steiner@gmail.com>2020-05-31 11:17:13 +0200
committerJerko Steiner <jerko.steiner@gmail.com>2020-05-31 11:46:10 +0200
commitb29e9867e8729ee507197bb016e8e2c74b33dfc7 (patch)
tree5c30e7ea5cb8a31555d786eddd02d561a4bfe984 /test/completion
parentb339a8bfa0ebbe42e3f824e85f6900101cee8244 (diff)
downloadale-b29e9867e8729ee507197bb016e8e2c74b33dfc7.zip
Add test for LSP autoimport
Diffstat (limited to 'test/completion')
-rw-r--r--test/completion/test_lsp_completion_parsing.vader70
1 files changed, 70 insertions, 0 deletions
diff --git a/test/completion/test_lsp_completion_parsing.vader b/test/completion/test_lsp_completion_parsing.vader
index 1fdbbd96..e233c955 100644
--- a/test/completion/test_lsp_completion_parsing.vader
+++ b/test/completion/test_lsp_completion_parsing.vader
@@ -526,3 +526,73 @@ Execute(Should handle completion messages with the deprecated insertText attribu
\ ],
\ },
\ })
+
+Execute(Should handle completion messages with additionalTextEdits):
+ AssertEqual
+ \ [
+ \ {
+ \ 'word': 'next_callback',
+ \ 'menu': 'PlayTimeCallback',
+ \ 'info': '',
+ \ 'kind': 'v',
+ \ 'icase': 1,
+ \ 'user_data': json_encode({
+ \ 'codeActions': [
+ \ {
+ \ 'description': 'completion',
+ \ 'changes': [
+ \ {
+ \ 'fileName': expand('#' . bufnr('') . ':p'),
+ \ 'textChanges': [
+ \ {
+ \ 'start': {
+ \ 'line': 11,
+ \ 'offset': 2,
+ \ },
+ \ 'end': {
+ \ 'line': 13,
+ \ 'offset': 4,
+ \ },
+ \ 'newText': 'from "module" import next_callback',
+ \ },
+ \ ],
+ \ },
+ \ ],
+ \ },
+ \ ],
+ \ }),
+ \ },
+ \ ],
+ \ ale#completion#ParseLSPCompletions({
+ \ 'id': 226,
+ \ 'jsonrpc': '2.0',
+ \ 'result': {
+ \ 'isIncomplete': v:false,
+ \ 'items': [
+ \ {
+ \ 'detail': 'PlayTimeCallback',
+ \ 'filterText': 'next_callback',
+ \ 'insertText': 'next_callback',
+ \ 'insertTextFormat': 1,
+ \ 'kind': 6,
+ \ 'label': ' next_callback',
+ \ 'sortText': '3ee19999next_callback',
+ \ 'additionalTextEdits': [
+ \ {
+ \ 'range': {
+ \ 'start': {
+ \ 'line': 10,
+ \ 'character': 1,
+ \ },
+ \ 'end': {
+ \ 'line': 12,
+ \ 'character': 3,
+ \ },
+ \ },
+ \ 'newText': 'from "module" import next_callback',
+ \ },
+ \ ],
+ \ },
+ \ ],
+ \ },
+ \ })