summaryrefslogtreecommitdiff
path: root/test/test_symbol_search.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2019-02-13 00:31:33 +0000
committerw0rp <devw0rp@gmail.com>2019-02-13 17:26:37 +0000
commit1ee56713b8f9cfd0faa99dd7930437fa7ed986b0 (patch)
tree47e49ac8038f82892316e2d42a973e168c3b8d9a /test/test_symbol_search.vader
parente88243687a2da8cd02962bc78874ec0e60aecaf2 (diff)
downloadale-1ee56713b8f9cfd0faa99dd7930437fa7ed986b0.zip
#2132 Use an on-init callback for all LSP logic
Diffstat (limited to 'test/test_symbol_search.vader')
-rw-r--r--test/test_symbol_search.vader24
1 files changed, 13 insertions, 11 deletions
diff --git a/test/test_symbol_search.vader b/test/test_symbol_search.vader
index 9d50e267..053a8b04 100644
--- a/test/test_symbol_search.vader
+++ b/test/test_symbol_search.vader
@@ -10,28 +10,30 @@ Before:
let g:options = {}
let g:capability_checked = ''
let g:conn_id = v:null
- let g:WaitCallback = v:null
+ let g:InitCallback = v:null
runtime autoload/ale/lsp_linter.vim
runtime autoload/ale/lsp.vim
runtime autoload/ale/util.vim
runtime autoload/ale/preview.vim
- function! ale#lsp_linter#StartLSP(buffer, linter) abort
+ function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort
let g:conn_id = ale#lsp#Register('executable', '/foo/bar', {})
call ale#lsp#MarkDocumentAsOpen(g:conn_id, a:buffer)
-
- return {
+ let l:details = {
\ 'buffer': a:buffer,
\ 'connection_id': g:conn_id,
\ 'project_root': '/foo/bar',
\ 'language_id': 'python',
\}
+
+ let g:InitCallback = {-> a:Callback(a:linter, l:details)}
endfunction
- function! ale#lsp#WaitForCapability(conn_id, capability, callback) abort
+ function! ale#lsp#HasCapability(conn_id, capability) abort
let g:capability_checked = a:capability
- let g:WaitCallback = a:callback
+
+ return 1
endfunction
function! ale#lsp#RegisterCallback(conn_id, callback) abort
@@ -59,7 +61,7 @@ After:
call ale#linter#Reset()
unlet! g:capability_checked
- unlet! g:WaitCallback
+ unlet! g:InitCallback
unlet! g:conn_id
unlet! g:Callback
unlet! g:message_list
@@ -159,10 +161,10 @@ Execute(LSP symbol requests should be sent):
" We shouldn't register the callback yet.
AssertEqual '''''', string(g:Callback)
- AssertEqual 'symbol_search', g:capability_checked
- AssertEqual type(function('type')), type(g:WaitCallback)
- call call(g:WaitCallback, [g:conn_id, '/foo/bar'])
+ AssertEqual type(function('type')), type(g:InitCallback)
+ call g:InitCallback()
+ AssertEqual 'symbol_search', g:capability_checked
AssertEqual
\ 'function(''ale#symbol#HandleLSPResponse'')',
\ string(g:Callback)
@@ -182,6 +184,6 @@ Execute('-relative' argument should enable 'use_relative_paths' in HandleLSPResp
ALESymbolSearch -relative foo bar
- call call(g:WaitCallback, [g:conn_id, '/foo/bar'])
+ call g:InitCallback()
AssertEqual {'42': {'buffer': bufnr(''), 'use_relative_paths': 1}}, ale#symbol#GetMap()