-
Notifications
You must be signed in to change notification settings - Fork 730
Fix unused identifier diags, LSP tag diags #2007
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
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.
Pull Request Overview
This PR changes how unused identifier diagnostics are handled based on compiler options. Previously, unused variables were only reported as errors when noUnusedLocals or noUnusedParameters flags were enabled. Now, unused identifiers are always checked and reported either as errors (when the respective flag is enabled) or as suggestions (when disabled).
Key changes:
- Unused identifiers are now always checked regardless of compiler options
- When
noUnusedLocals/noUnusedParametersare disabled, diagnostics are reported as suggestions instead of being omitted - Client capability checks for diagnostic tags have been removed from the language server, as the LSP spec requires clients to handle unknown tags
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/checker/checker.go | Refactored unused identifier checking to always run and conditionally report as error or suggestion based on compiler options |
| internal/ls/diagnostics.go | Removed client capability checks for diagnostic tags and added documentation comment; removed unused slices import |
|
are there any tests. i dont see any change in tests |
|
Unfortunately not, the current fourslash runner does not do diagnostics yet and that's a bigger ask I can tackle separately. I have tested this in the editor, however. |
|
Okay, this is now a pure port and should work fine. |
Fixes #2001 (mostly)
Issues:
noUnusedLocals/noUnusedParameterswas off, so the grayed out suggestion errors were never even calculated.reportUnuseddidn't actually usesuggestionDiagnosticsat all, nor have the bit that sets the category toSuggestionon the fly; I re-ported that code.tag support). Pull the info frompublishDiagnosticsas a backup, which is a hack but works around the problem until we can get v10 of the LSP client.The warning vs error thing is actually a VS Code setting, something we will have to do once those are passed in and handled.