natebosch / vim-lsc

A vim plugin for communicating with a language server
BSD 3-Clause "New" or "Revised" License
692 stars 83 forks source link

Add support for `relatedInformation` in diagnostics #322

Open natebosch opened 4 years ago

natebosch commented 4 years ago

For related locations in the same symbol we could highlight them when the cursor is over an error (or close on a line with an error? Could either pick the same diagnostic that is echoed or maybe all of them?).

There is a message associated with each location, not sure how to surface that.

Could also potentially have a way to navigate to them? Maybe with a command that populates the quickfix list, or opens a menu to pick one to navigate to?

MichaelRFairhurst commented 4 years ago

The easiest repro is probably this:

void f() {
  x + 1;
  var x = 1;
}

You should get related information saying something to the effect of "x is defined here" when you get the error "x is used before it is declared."

We will be using this for more and more things, however, its currently not super well supported in intelliJ, so it should not be a critical thing for vim to support. We are hoping to keep the UX as good as possible for clients that don't show this information super forwardly.