vim-lsp-ale icon indicating copy to clipboard operation
vim-lsp-ale copied to clipboard

Use ale to parse LSP response

Open georgeharker opened this issue 3 years ago • 5 comments

georgeharker avatar Jan 03 '22 19:01 georgeharker

This makes the highlighting of errors work, ensures that hover tips and bubbles work and gives cleaner loclist messages.

georgeharker avatar Jan 03 '22 19:01 georgeharker

Why don't you use ALE directly? This is a plugin to integrate vim-lsp and ALE. So it is basically not necessary when you want to use LSP support by ALE.

rhysd avatar Jan 03 '22 23:01 rhysd

I use vim-lsp, but prefer the error display handling in ALE. vim-lsp-ale lets me integrate the two so that there’s only one lsp server running - but, the highlighting of errors wasn’t as good as with ALE directly. This PR resolves that and allows ALE to display the gutter-hover descriptions, highlight the correct ranges etc. It’s still doing what it used to do and invoking vim-lsp for the lsp server portion, but it’s parsing the response with ALE.

Maybe I misunderstood something, but it looked like ale#lsp#response#ReadDiagnostics was only parsing diagnostics - but doing so more fully than the prior code was.

georgeharker avatar Jan 04 '22 00:01 georgeharker

With the modification in this PR, this plugin no longer uses vim-lsp since ALE will handle diagnostics via ale#lsp#response#ReadDiagnostics(diag). In that case, you don't need this plugin. You can just use both vim-lsp and ALE.

  1. Disable diagnostics feature in vim-lsp
  2. Enable LSP support in ALE

Then everything would work. For example, completion is done by vim-lsp and diagnostics is done by ALE.

rhysd avatar Jan 13 '22 07:01 rhysd

 Surely the prior call to lsp#internal#diagnostics#state#_get_all_diagnostics_grouped_by_server_for_uri is what gets the diagnostics from vim-lsp - therefore leveraging vin-lsp and vim-lsp’s lsp server. I didn’t change that. The only thing I’m suggesting changing is the way it gets into the loclisf, which ale does a better job of parsing that than vim-lsp does (ie lsp#ui#vim#utils#diagnostics_to_loc_list is less good than the equivalent ale function ale#lsp#response#ReadDiagnostics(diag) the former just seems to parse less of the diag and get less good highlighting, and doesn’t allow hover tips in the gutter ? It looks like neither function records anything nor does significant processing aside from pulling data from the diag into the loclisf.

No big deal if you don’t want to pull this, happy to keep a repo with my local tweaks, just figured the better highlighting and better leveraging of ales diagnostics might be interesting to folks.

George

On Wed, Jan 12, 2022 at 11:05 PM Linda_pp @.***> wrote:

With this modification, this plugin no longer uses vim-lsp since ALE will handle diagnostics via ale#lsp#response#ReadDiagnostics(diag). In this case, you don't need this plugin. You can just use both vim-lsp and ALE.

Disable diagnostics feature in vim-lsp Enable LSP support in ALE Then everything would work. For example, completion is done by vim-lsp and diagnostics is done by ALE.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

georgeharker avatar Jan 13 '22 08:01 georgeharker