summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/completion/test_lsp_completion_messages.vader35
-rw-r--r--test/lsp/test_lsp_client_messages.vader4
2 files changed, 25 insertions, 14 deletions
diff --git a/test/completion/test_lsp_completion_messages.vader b/test/completion/test_lsp_completion_messages.vader
index df340fbe..f21acfb9 100644
--- a/test/completion/test_lsp_completion_messages.vader
+++ b/test/completion/test_lsp_completion_messages.vader
@@ -15,7 +15,7 @@ Before:
runtime autoload/ale/lsp.vim
- let g:message = []
+ let g:message_list = []
let g:Callback = ''
function! ale#linter#StartLSP(buffer, linter, callback) abort
@@ -29,13 +29,13 @@ Before:
" Replace the Send function for LSP, so we can monitor calls to it.
function! ale#lsp#Send(conn_id, message, ...) abort
- let g:message = a:message
+ call add(g:message_list, a:message)
endfunction
After:
Restore
- unlet! g:message
+ unlet! g:message_list
unlet! g:Callback
unlet! b:ale_old_omnifunc
unlet! b:ale_old_completopt
@@ -75,8 +75,8 @@ Execute(The right message should be sent for the initial tsserver request):
\ string(g:Callback)
" We should send the right message.
AssertEqual
- \ [0, 'ts@completions', {'file': expand('%:p'), 'line': 1, 'offset': 3, 'prefix': 'fo'}],
- \ g:message
+ \ [[0, 'ts@completions', {'file': expand('%:p'), 'line': 1, 'offset': 3, 'prefix': 'fo'}]],
+ \ g:message_list
" We should set up the completion info correctly.
AssertEqual
\ {
@@ -118,7 +118,7 @@ Execute(The right message sent to the tsserver LSP when the first completion mes
" The entry details messages should have been sent.
AssertEqual
- \ [
+ \ [[
\ 0,
\ 'ts@completionEntryDetails',
\ {
@@ -127,8 +127,8 @@ Execute(The right message sent to the tsserver LSP when the first completion mes
\ 'offset': 1,
\ 'line': 1,
\ },
- \ ],
- \ g:message
+ \ ]],
+ \ g:message_list
Given python(Some Python file):
foo
@@ -152,12 +152,23 @@ Execute(The right message should be sent for the initial LSP request):
" We should send the right message.
" The character index needs to be at most the index of the last character on
" the line, or integration with pyls will be broken.
+ "
+ " We need to send the message for changing the document first.
AssertEqual
- \ [0, 'textDocument/completion', {
+ \ [
+ \ [1, 'textDocument/didChange', {
+ \ 'textDocument': {
+ \ 'uri': ale#path#ToURI(expand('%:p')),
+ \ 'version': g:ale_lsp_next_version_id - 1,
+ \ },
+ \ 'contentChanges': [{'text': join(getline(1, '$'), "\n") . "\n"}]
+ \ }],
+ \ [0, 'textDocument/completion', {
\ 'textDocument': {'uri': ale#path#ToURI(expand('%:p'))},
- \ 'position': {'line': 0, 'character': 2},
- \ }],
- \ g:message
+ \ 'position': {'line': 0, 'character': 3},
+ \ }],
+ \ ],
+ \ g:message_list
" We should set up the completion info correctly.
AssertEqual
\ {
diff --git a/test/lsp/test_lsp_client_messages.vader b/test/lsp/test_lsp_client_messages.vader
index bd0cd102..346f79ca 100644
--- a/test/lsp/test_lsp_client_messages.vader
+++ b/test/lsp/test_lsp_client_messages.vader
@@ -110,7 +110,7 @@ Execute(ale#lsp#message#Completion() should return correct messages):
\ 'textDocument': {
\ 'uri': ale#path#ToURI(g:dir . '/foo/bar.ts'),
\ },
- \ 'position': {'line': 11, 'character': 33},
+ \ 'position': {'line': 11, 'character': 34},
\ }
\ ],
\ ale#lsp#message#Completion(bufnr(''), 12, 34, '')
@@ -124,7 +124,7 @@ Execute(ale#lsp#message#Completion() should return correct messages with a trigg
\ 'textDocument': {
\ 'uri': ale#path#ToURI(g:dir . '/foo/bar.ts'),
\ },
- \ 'position': {'line': 11, 'character': 33},
+ \ 'position': {'line': 11, 'character': 34},
\ 'context': {'triggerKind': 2, 'triggerCharacter': '.'},
\ }
\ ],