diff options
author | w0rp <devw0rp@gmail.com> | 2018-08-24 13:16:58 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-08-24 13:16:58 +0100 |
commit | c4eca7c417945a684949342da8d0ab30e6c82b3a (patch) | |
tree | 28fa491c27f55bdec521c32cbc4b40f823394c74 /test/test_find_references.vader | |
parent | 9d7c48038cbbc696fe2d1e9c4b2d9eff2dd726c3 (diff) | |
download | ale-c4eca7c417945a684949342da8d0ab30e6c82b3a.zip |
Use one LSP connection per project
Diffstat (limited to 'test/test_find_references.vader')
-rw-r--r-- | test/test_find_references.vader | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/test/test_find_references.vader b/test/test_find_references.vader index ecced068..88b2d762 100644 --- a/test/test_find_references.vader +++ b/test/test_find_references.vader @@ -9,6 +9,7 @@ Before: let g:preview_called = 0 let g:item_list = [] let g:capability_checked = '' + let g:conn_id = v:null let g:WaitCallback = v:null runtime autoload/ale/linter.vim @@ -17,19 +18,18 @@ Before: runtime autoload/ale/preview.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 @@ -38,7 +38,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 @@ -54,7 +54,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#references#SetMap({}) call ale#test#RestoreDirectory() call ale#linter#Reset() @@ -62,6 +65,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 @@ -168,7 +172,7 @@ Execute(tsserver reference requests should be sent): AssertEqual type(function('type')), type(g:WaitCallback) AssertEqual 'references', g:capability_checked - call call(g:WaitCallback, [347, '/foo/bar']) + call call(g:WaitCallback, [g:conn_id, '/foo/bar']) AssertEqual \ 'function(''ale#references#HandleTSServerResponse'')', @@ -249,7 +253,7 @@ Execute(LSP reference requests should be sent): AssertEqual type(function('type')), type(g:WaitCallback) AssertEqual 'references', g:capability_checked - call call(g:WaitCallback, [347, '/foo/bar']) + call call(g:WaitCallback, [g:conn_id, '/foo/bar']) AssertEqual \ 'function(''ale#references#HandleLSPResponse'')', |