Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show diagnostics via ALE #800

Open
gbrlsnchs opened this issue Apr 23, 2019 · 1 comment
Open

Show diagnostics via ALE #800

gbrlsnchs opened this issue Apr 23, 2019 · 1 comment

Comments

@gbrlsnchs
Copy link

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:

  • text - Required error message.
  • detail - Optional, more descriptive message. If set, it is displayed in place of text when ALEDetail is called.
  • lnum - Required, preferably a number, as when a string it gets converted using str2nr(). It refers to the error line number. Check docs for more details.
  • col - Optional error column number, default is 0.
  • end_col - Optional end column number, improves error highlights.
  • end_lnum - Optional end line number, it improves multi-line error highlights.
  • filename- Optional filename. Should be an absolute path to the file. Check docs for more details.
  • type - Diagnostic severity. Defaults to 'E'.

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
Copy link

kishansairam9 commented Jul 18, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants