Only send LSP config updates when the dict changes

Each LSP connection now stores its configuration dictionary. It is
initially empty (`{}`) and is updated each time the LSP connection is
started. When a change is detected, the workspace/didChangeConfiguration
message is sent to the LSP servers with the updated configuration.
This commit is contained in:
Jon Parise
2018-10-31 08:42:42 -07:00
parent b5a7593577
commit 2ac9e2a29e
4 changed files with 41 additions and 7 deletions
+2 -7
View File
@@ -201,13 +201,6 @@ function! ale#lsp_linter#StartLSP(buffer, linter) abort
endif
let l:config = ale#lsp_linter#GetConfig(a:buffer, a:linter)
if !empty(l:config)
" set LSP configuration options (workspace/didChangeConfiguration)
let l:config_message = ale#lsp#message#DidChangeConfiguration(a:buffer, l:config)
call ale#lsp#Send(l:conn_id, l:config_message)
endif
let l:language_id = ale#util#GetFunction(a:linter.language_callback)(a:buffer)
let l:details = {
@@ -218,6 +211,8 @@ function! ale#lsp_linter#StartLSP(buffer, linter) abort
\ 'language_id': l:language_id,
\}
call ale#lsp#UpdateConfig(l:conn_id, a:buffer, l:config)
if ale#lsp#OpenDocument(l:conn_id, a:buffer, l:language_id)
if g:ale_history_enabled && !empty(l:command)
call ale#history#Add(a:buffer, 'started', l:conn_id, l:command)