summaryrefslogtreecommitdiff
path: root/test/completion/test_lsp_completion_parsing.vader
diff options
context:
space:
mode:
Diffstat (limited to 'test/completion/test_lsp_completion_parsing.vader')
-rw-r--r--test/completion/test_lsp_completion_parsing.vader76
1 files changed, 76 insertions, 0 deletions
diff --git a/test/completion/test_lsp_completion_parsing.vader b/test/completion/test_lsp_completion_parsing.vader
index 8b8b41c7..395314d7 100644
--- a/test/completion/test_lsp_completion_parsing.vader
+++ b/test/completion/test_lsp_completion_parsing.vader
@@ -537,6 +537,7 @@ Execute(Should handle completion messages with the deprecated insertText attribu
Execute(Should handle completion messages with additionalTextEdits when ale_completion_autoimport is turned on):
let g:ale_completion_autoimport = 1
+ let b:ale_completion_info = {'line': 30}
AssertEqual
\ [
@@ -591,6 +592,19 @@ Execute(Should handle completion messages with additionalTextEdits when ale_comp
\ {
\ 'range': {
\ 'start': {
+ \ 'line': 29,
+ \ 'character': 10,
+ \ },
+ \ 'end': {
+ \ 'line': 29,
+ \ 'character': 10,
+ \ },
+ \ },
+ \ 'newText': 'next_callback',
+ \ },
+ \ {
+ \ 'range': {
+ \ 'start': {
\ 'line': 10,
\ 'character': 1,
\ },
@@ -609,6 +623,7 @@ Execute(Should handle completion messages with additionalTextEdits when ale_comp
Execute(Should not handle completion messages with additionalTextEdits when ale_completion_autoimport is turned off):
let g:ale_completion_autoimport = 0
+ let b:ale_completion_info = {'line': 30}
AssertEqual
\ [],
@@ -630,6 +645,19 @@ Execute(Should not handle completion messages with additionalTextEdits when ale_
\ {
\ 'range': {
\ 'start': {
+ \ 'line': 29,
+ \ 'character': 10,
+ \ },
+ \ 'end': {
+ \ 'line': 29,
+ \ 'character': 10,
+ \ },
+ \ },
+ \ 'newText': 'next_callback',
+ \ },
+ \ {
+ \ 'range': {
+ \ 'start': {
\ 'line': 10,
\ 'character': 1,
\ },
@@ -645,3 +673,51 @@ Execute(Should not handle completion messages with additionalTextEdits when ale_
\ ],
\ },
\ })
+
+Execute(Should still handle completion messages with additionalTextEdits with ale_completion_autoimport turned off, if edits all start on the line):
+ let g:ale_completion_autoimport = 0
+ let b:ale_completion_info = {'line': 30}
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'word': 'next_callback',
+ \ 'menu': 'PlayTimeCallback',
+ \ 'info': '',
+ \ 'kind': 'v',
+ \ 'icase': 1,
+ \ }
+ \ ],
+ \ 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': 29,
+ \ 'character': 10,
+ \ },
+ \ 'end': {
+ \ 'line': 29,
+ \ 'character': 10,
+ \ },
+ \ },
+ \ 'newText': 'next_callback',
+ \ },
+ \ ],
+ \ },
+ \ ],
+ \ },
+ \ })