summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-07-03 01:41:46 +0100
committerw0rp <devw0rp@gmail.com>2018-07-03 01:41:46 +0100
commite46474ac0a86292bd336b5b05452bed1a681605c (patch)
tree1f196a7ded2ee95e274f1c7dacbb1c7bb16eb711 /autoload
parent5aba55bb8634ea0304eab711e861098f99b70318 (diff)
downloadale-e46474ac0a86292bd336b5b05452bed1a681605c.zip
Close #830 - Implement LSP connections via TCP sockets
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/lsp.vim12
-rw-r--r--autoload/ale/lsp_linter.vim2
2 files changed, 7 insertions, 7 deletions
diff --git a/autoload/ale/lsp.vim b/autoload/ale/lsp.vim
index b7f8c542..e44b5bc3 100644
--- a/autoload/ale/lsp.vim
+++ b/autoload/ale/lsp.vim
@@ -3,7 +3,7 @@
" A List of connections, used for tracking servers which have been connected
" to, and programs which are run.
-let s:connections = []
+let s:connections = get(s:, 'connections', [])
let g:ale_lsp_next_message_id = 1
" Exposed only so tests can get at it.
@@ -36,7 +36,7 @@ endfunction
function! s:FindConnection(key, value) abort
for l:conn in s:connections
- if has_key(l:conn, a:key) && get(l:conn, a:key) == a:value
+ if has_key(l:conn, a:key) && get(l:conn, a:key) is# a:value
return l:conn
endif
endfor
@@ -319,13 +319,13 @@ function! ale#lsp#ConnectToAddress(address, project_root, callback, initializati
let l:conn = !empty(l:conn) ? l:conn : ale#lsp#NewConnection(a:initialization_options)
if !has_key(l:conn, 'channel_id') || !ale#socket#IsOpen(l:conn.channel_id)
- let l:conn.channnel_id = ale#socket#Open(a:address, {
+ let l:conn.channel_id = ale#socket#Open(a:address, {
\ 'callback': function('s:HandleChannelMessage'),
\})
endif
- if l:conn.channnel_id < 0
- return 0
+ if l:conn.channel_id < 0
+ return ''
endif
let l:conn.id = a:address
@@ -333,7 +333,7 @@ function! ale#lsp#ConnectToAddress(address, project_root, callback, initializati
call uniq(sort(add(l:conn.callback_list, a:callback)))
call ale#lsp#RegisterProject(l:conn, a:project_root)
- return 1
+ return a:address
endfunction
" Stop all LSP connections, closing all jobs and channels, and removing any
diff --git a/autoload/ale/lsp_linter.vim b/autoload/ale/lsp_linter.vim
index 781d04c4..9e72362b 100644
--- a/autoload/ale/lsp_linter.vim
+++ b/autoload/ale/lsp_linter.vim
@@ -166,7 +166,7 @@ function! ale#lsp_linter#StartLSP(buffer, linter, callback) abort
let l:language_id = ale#util#GetFunction(a:linter.language_callback)(a:buffer)
- if !l:conn_id
+ if empty(l:conn_id)
if g:ale_history_enabled && !empty(l:command)
call ale#history#Add(a:buffer, 'failed', l:conn_id, l:command)
endif