Skip to content

Conversation

@JoeRobich
Copy link
Member

  • A server-side change is being made to report diagnostics with their reported severity (Return LSP diagnostics with their reported severity. roslyn#77145).
  • This adds client-side middleware to allow users who prefer to not see information diagnostics in their editor have those diagnostics be reported as hint.
  • Middleware required updated vscode-languageclient packages which caused many imported to be updated due changes in what types are exported from which packages.

Resolves #6723

- 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.
@JoeRobich JoeRobich requested a review from dibarbet February 10, 2025 22:47
@JoeRobich JoeRobich requested review from a team as code owners February 10, 2025 22:47
@JoeRobich JoeRobich force-pushed the dev/jorobich/report-all-diagnostics branch from 0c57903 to 252c0e5 Compare February 10, 2025 22:57
}
}
dispose(): void {
clear(): void {
Copy link
Member Author

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);
Copy link
Member Author

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';
Copy link
Member Author

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), []);
Copy link
Member Author

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.

Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

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',
Copy link
Member Author

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": {
Copy link
Member Author

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.

JoeRobich added a commit to dotnet/roslyn that referenced this pull request Feb 11, 2025
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
Copy link
Member

@dibarbet dibarbet left a 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';
Copy link
Member

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

Copy link
Member Author

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), []);
Copy link
Member

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",
Copy link
Member

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

Copy link
Member Author

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.

@JoeRobich JoeRobich enabled auto-merge February 21, 2025 21:31
@JoeRobich JoeRobich merged commit b5f32c4 into main Feb 21, 2025
16 checks passed
@JoeRobich JoeRobich deleted the dev/jorobich/report-all-diagnostics branch February 21, 2025 22:24
ryzngard pushed a commit to dotnet/razor that referenced this pull request Feb 26, 2025
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.
@mikes-gh
Copy link

mikes-gh commented Mar 3, 2025

@JoeRobich Thank you for giving us the choice. Been waiting a long time to get my infos back.
I can confirm my infos are now listed in the problems pane and I can navigate to them from there.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Diagnostics of info/suggestion level severity are ignored by Problems pane and shortcuts

5 participants