summaryrefslogtreecommitdiff
path: root/test/test_go_to_definition.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-08-24 13:16:58 +0100
committerw0rp <devw0rp@gmail.com>2018-08-24 13:16:58 +0100
commitc4eca7c417945a684949342da8d0ab30e6c82b3a (patch)
tree28fa491c27f55bdec521c32cbc4b40f823394c74 /test/test_go_to_definition.vader
parent9d7c48038cbbc696fe2d1e9c4b2d9eff2dd726c3 (diff)
downloadale-c4eca7c417945a684949342da8d0ab30e6c82b3a.zip
Use one LSP connection per project
Diffstat (limited to 'test/test_go_to_definition.vader')
-rw-r--r--test/test_go_to_definition.vader26
1 files changed, 15 insertions, 11 deletions
diff --git a/test/test_go_to_definition.vader b/test/test_go_to_definition.vader
index 53f566e9..c64db514 100644
--- a/test/test_go_to_definition.vader
+++ b/test/test_go_to_definition.vader
@@ -7,6 +7,7 @@ Before:
let g:message_list = []
let g:expr_list = []
let g:capability_checked = ''
+ let g:conn_id = v:null
let g:WaitCallback = v:null
runtime autoload/ale/linter.vim
@@ -14,19 +15,18 @@ Before:
runtime autoload/ale/util.vim
function! ale#lsp_linter#StartLSP(buffer, linter) abort
- let l:conn = ale#lsp#NewConnection({})
- let l:conn.id = 347
- let l:conn.open_documents = {a:buffer : -1}
+ let g:conn_id = ale#lsp#Register('executable', '/foo/bar', {})
+ call ale#lsp#MarkDocumentAsOpen(g:conn_id, a:buffer)
return {
\ 'buffer': a:buffer,
- \ 'connection_id': 347,
+ \ 'connection_id': g:conn_id,
\ 'project_root': '/foo/bar',
\ 'language_id': 'python',
\}
endfunction
- function! ale#lsp#WaitForCapability(conn_id, project_root, capability, callback) abort
+ function! ale#lsp#WaitForCapability(conn_id, capability, callback) abort
let g:capability_checked = a:capability
let g:WaitCallback = a:callback
endfunction
@@ -35,7 +35,7 @@ Before:
let g:Callback = a:callback
endfunction
- function! ale#lsp#Send(conn_id, message, root) abort
+ function! ale#lsp#Send(conn_id, message) abort
call add(g:message_list, a:message)
return 42
@@ -46,7 +46,10 @@ Before:
endfunction
After:
- call ale#lsp#RemoveConnectionWithID(347)
+ if g:conn_id isnot v:null
+ call ale#lsp#RemoveConnectionWithID(g:conn_id)
+ endif
+
call ale#definition#SetMap({})
call ale#test#RestoreDirectory()
call ale#linter#Reset()
@@ -54,6 +57,7 @@ After:
unlet! g:capability_checked
unlet! g:WaitCallback
unlet! g:old_filename
+ unlet! g:conn_id
unlet! g:Callback
unlet! g:message_list
unlet! g:expr_list
@@ -153,7 +157,7 @@ Execute(tsserver completion requests should be sent):
AssertEqual type(function('type')), type(g:WaitCallback)
AssertEqual 'definition', g:capability_checked
- call call(g:WaitCallback, [347, '/foo/bar'])
+ call call(g:WaitCallback, [g:conn_id, '/foo/bar'])
AssertEqual
\ 'function(''ale#definition#HandleTSServerResponse'')',
@@ -174,7 +178,7 @@ Execute(tsserver tab completion requests should be sent):
AssertEqual type(function('type')), type(g:WaitCallback)
AssertEqual 'definition', g:capability_checked
- call call(g:WaitCallback, [347, '/foo/bar'])
+ call call(g:WaitCallback, [g:conn_id, '/foo/bar'])
AssertEqual
\ 'function(''ale#definition#HandleTSServerResponse'')',
@@ -306,7 +310,7 @@ Execute(LSP completion requests should be sent):
AssertEqual type(function('type')), type(g:WaitCallback)
AssertEqual 'definition', g:capability_checked
- call call(g:WaitCallback, [347, '/foo/bar'])
+ call call(g:WaitCallback, [g:conn_id, '/foo/bar'])
AssertEqual
\ 'function(''ale#definition#HandleLSPResponse'')',
@@ -342,7 +346,7 @@ Execute(LSP tab completion requests should be sent):
AssertEqual type(function('type')), type(g:WaitCallback)
AssertEqual 'definition', g:capability_checked
- call call(g:WaitCallback, [347, '/foo/bar'])
+ call call(g:WaitCallback, [g:conn_id, '/foo/bar'])
AssertEqual
\ 'function(''ale#definition#HandleLSPResponse'')',