autozimu / LanguageClient-neovim

Language Server Protocol (LSP) support for vim and neovim.
MIT License
3.55k stars 272 forks source link

Show diagnostics via ALE #800

Open gbrlsnchs opened 5 years ago

gbrlsnchs commented 5 years ago

Is your feature request related to a problem? Please describe.

This is based on my experience using coc.nvim. I prefer this LSP client (it's purer than coc.nvim and is FZF-friendly), but coc.nvim has some undeniably cool features that I would like to see being ported here. I might help as well if this is out of scope or too difficult to be implemented, even though my Rust knowledge is limited.

One great feature of coc.nvim is being able to display diagnostics via ALE (coc's implementation here). This way, warnings and errors are visually unified and they don't need to override one another.

Describe the solution you'd like

I'll try to be as technical as possible: ALE has a method called ale#other_source#ShowResults that enables showing results (diagnostics) from another source of information. It receives three arguments: buffer number, source name and a so-called loclist.

According to :h ale-loclist-format, loclist is a dictionary. Here are the relevant fields for this plugin:

Describe alternatives you've considered

Using two diagnostics systems, which is inferior to unifying both. For example, I'd rather have only one Lightline extension than two or more.

Additional context

I haven't peeked at the source code yet, so I'm not aware of how difficult it is to implement this feature, nor if it's even relevant for the maintainers. Anyway, I thought it would be a great addition to this plugin as ALE is widely adopted for linting and stuff and it's diagnostics system is pretty robust.

Excellent work so far! Thank you very much.

kishansairam9 commented 5 years ago

At least can we have Lint on Save feature instead of Change Throttle ? @autozimu It is more useful for many of us than just linting after a period of time.

A feature like LanguageClient#textDocument_formatting_sync() for diagnostics might be enough. Since we can use autocmd BufWritePre to enable lint before save.