-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
Add unused diagnostic subtype #49646
Conversation
Other tags that Roslyn supports: http://source.roslyn.io/#Microsoft.CodeAnalysis/Diagnostic/WellKnownDiagnosticTags.cs,03ef56ba68ffca36 |
src/vs/vscode.d.ts
Outdated
/** | ||
* Unused or unnecessary code. | ||
*/ | ||
Unnecessary = 'unnecessary' |
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 other tags do we envision? Any of those used by Roslyn seem very specific: http://source.roslyn.io/#Microsoft.CodeAnalysis/Diagnostic/WellKnownDiagnosticTags.cs,03ef56ba68ffca36,references, in fact I only understand half of them... Is this maybe a dupe of #24682 just with some predefined tags/defaults that we know how to render? Will there be a future with custom rendering of tags? |
Further questions to seed some disucssion
|
Fixes #15710 Adds a new `DiagnosticTag` class that provide additional information about a diagnostic. Introduce `DiagnosticTag.Unnecessary` to mark when a diagnostic is for unused / unnecessary code The design comes from Rosyln's diagnostic object and allows us to modify how a diagnostic is rendered without changing its serverity. Hooks up JS and TS to use this new tag. This is controlled by the `javascript.showUnused.enabled` setting which is enabled by default - Introduce a new diagnostic severity for unused. However, using this approach, if a user sets `noUnusedLocals` in their `tsconfig.json`, the resulting diagnostic could only show the squiggly OR be grayed out. Using `customTags` allows us to support both graying out and showing the squiggly - Custom JS/TS implementation using decorators Not themable. We want a standard experience across languages.
- Use numeric enum
Merging with proposed api using diagnostic tags. We can revisit this to see if we want try implementing this with a semantic highlighting api next iteration |
Fixes #15710
Adds a new
DiagnosticTag
class that provide additional information about a diagnostic. IntroduceDiagnosticTag.Unnecessary
to mark when a diagnostic is for unused / unnecessary codeThe design comes from Rosyln's diagnostic object and allows us to modify how a diagnostic is rendered without changing its serverity.
Hooks up JS and TS to use this new tag. This is controlled by the
javascript.showUnused.enabled
setting which is enabled by defaultAlternate design considered
Introduce a new diagnostic severity for unused.
However, using this approach, if a user sets
noUnusedLocals
in theirtsconfig.json
, the resulting diagnostic could only show the squiggly OR be grayed out. UsingcustomTags
allows us to support both graying out and showing the squigglyCustom JS/TS implementation using decorators
Not themable. We want a standard experience across languages.