Handle Neovim LSP diagnostics via ALE's functions

This commit is contained in:
w0rp
2025-03-17 18:16:00 +00:00
parent c9eb8f9d15
commit 61a1fcc92f
2 changed files with 28 additions and 9 deletions

View File

@@ -488,12 +488,6 @@ function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort
endfunction
function! s:CheckWithLSP(linter, details) abort
if g:ale_use_neovim_lsp_api && a:linter.lsp isnot# 'tsserver'
" If running an LSP client via Neovim's API then Neovim will
" internally track buffers for changes for us, and we can stop here.
return
endif
let l:buffer = a:details.buffer
let l:info = get(g:ale_buffer_info, l:buffer)
@@ -503,13 +497,19 @@ function! s:CheckWithLSP(linter, details) abort
let l:id = a:details.connection_id
" Remember the linter this connection is for.
let s:lsp_linter_map[l:id] = a:linter
if g:ale_use_neovim_lsp_api && a:linter.lsp isnot# 'tsserver'
" If running an LSP client via Neovim's API then Neovim will
" internally track buffers for changes for us, and we can stop here.
return
endif
" Register a callback now for handling errors now.
let l:Callback = function('ale#lsp_linter#HandleLSPResponse')
call ale#lsp#RegisterCallback(l:id, l:Callback)
" Remember the linter this connection is for.
let s:lsp_linter_map[l:id] = a:linter
if a:linter.lsp is# 'tsserver'
let l:message = ale#lsp#tsserver_message#Geterr(l:buffer)
let l:notified = ale#lsp#Send(l:id, l:message) != 0