Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Add a "group" field to Diagnostic#681

Merged
Xanewok merged 4 commits intorust-lang:masterfrom
sebastiencs:group_diagnostic
Feb 10, 2018
Merged

Add a "group" field to Diagnostic#681
Xanewok merged 4 commits intorust-lang:masterfrom
sebastiencs:group_diagnostic

Conversation

@sebastiencs
Copy link
Contributor

@sebastiencs sebastiencs commented Jan 24, 2018

With #664, clients now receive secondary labels as a single diagnostic.

The issue is that clients don't know to which error belong all the secondary diagnostics.
Adding a group field solves this problem.
I intentionally made the minimum and simple changes to the code. Clients are free to ignore the field

I worked a bit with my editor to display the labels and it renders like this:
peek 24-01-2018 02-44

If this is accepted I will make a PR to languageserver-types

cc @Xanewok @alexheretic

@Xanewok
Copy link
Contributor

Xanewok commented Jan 26, 2018

Relevant comment: microsoft/language-server-protocol#166 (comment).

This seems like a small enough change, but I really hope that other LSP clients will only ignore extra data and not crash/misbehave on receiving custom diagnostics.

@sebastiencs could you please also try this with other LSP clients and see if it's not causing any troubles? That'd be very much appreciated!

@sebastiencs
Copy link
Contributor Author

@Xanewok Alright I will test with some editors and come back here

@sebastiencs
Copy link
Contributor Author

I just made the PR on languageserver-types gluon-lang/lsp-types#50

@Xanewok I have tested with vim/neovim, VS Code, Sublime Text and emacs.
They all behave correctly.

Copy link
Contributor

@Xanewok Xanewok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's land this together with languageserver-types update

v.clear();
}

let mut group = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style nit: could we use for (group, msg) in messages.iter().enumerate() instead? Seems cleaner than manually updating the group counter

@sebastiencs
Copy link
Contributor Author

@Xanewok Done, I've updated languageserver-types too

@Xanewok
Copy link
Contributor

Xanewok commented Feb 10, 2018

Awesome, thanks!

I'll merge this now, but in the meantime it'd be good to document any extensions we're currently using (such as this one). @sebastiencs would you mind also updating the https://github.com/rust-lang-nursery/rls/blob/master/contributing.md#extensions-to-the-language-server-protocol section, mentioning the change here?

@Xanewok Xanewok merged commit d8998b6 into rust-lang:master Feb 10, 2018
@sebastiencs
Copy link
Contributor Author

Alright I will do that :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants