-
Notifications
You must be signed in to change notification settings - Fork 727
Manage information diagnostic severity on the client-side. #7984
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
Conversation
- A server-side change is being made to report diagnostics with their reported severity. - This adds client-side middleware to allow users who prefer to not see information diagnostics in their editor have those diagnostics be reproted as hint.
0c57903 to
252c0e5
Compare
| } | ||
| } | ||
| dispose(): void { | ||
| clear(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API change
| if (response.edit) { | ||
| const uriConverter: URIConverter = (value: string): vscode.Uri => UriConverter.deserialize(value); | ||
| const protocolConverter = createConverter(uriConverter, true, true); | ||
| const protocolConverter = createConverter(uriConverter, true, true, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createConverter added support for Theme Icons
| MessageSignature, | ||
| ServerOptions, | ||
| } from 'vscode-languageclient/node'; | ||
| import { CancellationToken, MessageSignature } from 'vscode-jsonrpc'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of places where types are only being exported from their implementation package.
| export function combineDocumentSelectors( | ||
| ...selectors: (DocumentSelector | vscode.DocumentSelector)[] | ||
| ): vscode.DocumentSelector { | ||
| return selectors.reduce<(string | vscode.DocumentFilter)[]>((acc, selector) => acc.concat(<any>selector), []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DocumentSelector types do not quite match up anymore. I expect this will be resolved in a future "@types/vscode" package update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we be using the vscode document selector types here? And not the LSP versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we weren't previously but that doesn't mean that we can't. Will look at it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Long story short, we need to use both types of DocumentSelector. ClientLanguageOptions requires the LSP type and various calls require the vscode type. When vscode moves to the newer vscode-languageserver package, I expect these to become equivalent again.
| 'componentPaths', | ||
| 'enableXamlTools', | ||
| 'useServerGC', | ||
| 'reportInformationAsHint', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing 'reportInformationAsHint' will prompt for the user to reload the workspace
| "lib": [ | ||
| "ES2021" | ||
| ], | ||
| "paths": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exports have changed in these packages. I think if we were able to use a different module resolution behavior they would not be necessary. Added alias paths here and in webpack config.
For VSCode we were adjusting information diagnostics severity so that they would be reported as hints. We are moving this behavior to the client and allowing users to opt-in. Client-side PR: dotnet/vscode-csharp#7984 Part of dotnet/vscode-csharp#6723
dibarbet
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fine with the majority of the changes - but definitely think we should avoid changing the default for now here.
| *--------------------------------------------------------------------------------------------*/ | ||
| import * as vscode from 'vscode'; | ||
| import { RequestType } from 'vscode-languageclient/node'; | ||
| import { RequestType } from 'vscode-jsonrpc'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happened here - did types get moved around? Would have thought we would be using the language client API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So these packages are layered dependencies. Packages higher up are not re-exporting all these types from those beneath anymore.
| export function combineDocumentSelectors( | ||
| ...selectors: (DocumentSelector | vscode.DocumentSelector)[] | ||
| ): vscode.DocumentSelector { | ||
| return selectors.reduce<(string | vscode.DocumentFilter)[]>((acc, selector) => acc.concat(<any>selector), []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we be using the vscode document selector types here? And not the LSP versions?
| "vscode-languageclient": "8.2.0-next.1", | ||
| "vscode-languageserver-protocol": "3.17.4-next.1", | ||
| "vscode-languageserver-textdocument": "^1.0.5", | ||
| "vscode-jsonrpc": "9.0.0-next.7", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the new server package version is available now, we should probably include it in this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also need to update the diagnostic integration tests for this change.
TLDR: This was always wrong. The spec doesn't say anything, but VS Code always threw in converting these diagnostics (silently) and VS seems to do the same. VS Code had a lot of version bumps in this change dotnet/vscode-csharp#7984 Unfortunately, that changed vscode-languageclient from 8.2.0-next.1 to 10.0.0-next.14. Functionally this wasn't a problem, but it did add a sneaky line here to helpfully let extension developers know they are doing something wrong very loudly microsoft/vscode-languageserver-node@release/client/8.2.0-next.1...release/client/10.0.0-next.14#diff-1442f78812 This change meant that diagnostics we sent prior that could not be converted correctly (such as a negative line number) would silently bubble up and be dropped. Now there is an error reported that matches exactly what devdiv.visualstudio.com/DevDiv/_workitems/edit/2397532?view=edit reports. From testing VS also drops these diagnostics so there's no real point in keeping them. I'd rather find bugs where a user expects diagnostics that aren't there than yell at a user for our code doing bad things.
|
@JoeRobich Thank you for giving us the choice. Been waiting a long time to get my infos back. |
Resolves #6723