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

Improve diagnostics #424

Open
Arthurm1 opened this issue Mar 8, 2025 · 3 comments
Open

Improve diagnostics #424

Arthurm1 opened this issue Mar 8, 2025 · 3 comments

Comments

@Arthurm1
Copy link

Arthurm1 commented Mar 8, 2025

Is your feature request related to a problem? Please describe.

BSP and LSP have 3 diagnostic fields that are (almost) ignored by Metals: tags, codeDescription and relatedInformation

Describe the solution you'd like

Could Metals pass on these 3 fields from BSP to LSP?

BSP spec for Diagnostic is here
LSP spec for Diagnostic is here
Metals code is here

Metals could pass on the fields and still enhance the tags with the current deprecation check based on code if the BSP server isn't passing tags back.

There are support flags sent by the LSP client...
capabilities#textDocument#publishDiagnostics#codeDescriptionSupport
capabilities#textDocument#publishDiagnostics#tagSupport
capabilities#textDocument#publishDiagnostics#relatedInformation
I'm not sure if these flags should be checked before populating the info or whether a client will just ignore any additional information. Documentation here

Describe alternatives you've considered

The diagnostics are pretty good as is but this would be icing on the cake.

Additional context

This was also requested in #309 but only for the deprecated tag. These additional fields would be helpful as well although I've not had to use the relatedInformation field.

Search terms

Diagnostics deprecated unused codedescription relatedinformation

@tgodzik
Copy link
Contributor

tgodzik commented Mar 11, 2025

Wouldn't scalameta/metals#7294 achieve what you want?

@Arthurm1
Copy link
Author

LGTM.

Not sure if there are any issues with version mismatches. i.e. newer version of Bloop supplies a field in Diagnostic that an older version of VSCode doesn't have. But I imagine the clients just ignore additional fields?

@tgodzik
Copy link
Contributor

tgodzik commented Mar 11, 2025

LGTM.

Not sure if there are any issues with version mismatches. i.e. newer version of Bloop supplies a field in Diagnostic that an older version of VSCode doesn't have. But I imagine the clients just ignore additional fields?

That's the usual behaviour, I haven't seen issues with more fields only ever with wrong ones.

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

No branches or pull requests

2 participants