-
Notifications
You must be signed in to change notification settings - Fork 24
implemented @deprecated diagnostics reporting #430
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
base: main
Are you sure you want to change the base?
implemented @deprecated diagnostics reporting #430
Conversation
@varungandhi-src this PR should be ready for review. Happy to punt on the idea if you'd prefer the scip-typescript indexer not providing this as well |
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.
Overall I think it's fine to add support for features like this; left some inline comments on specifics.
new scip.scip.Diagnostic({ | ||
severity: scip.scip.Severity.Information, | ||
code: 'DEPRECATED', | ||
message: deprecatedTag.text?.map(part => part.text).join(''), |
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 don't quite understand when we'll have multiple elements here, and why it's justified to join with ''
instead of say ' '
. Could you explain that? It'd be good to add a code comment for this.
new Foo() | ||
// ^^^ reference diagnostics 0.0.1 `index.ts`/Foo# | ||
// diagnostic Information: | ||
// > This class is deprecated |
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.
It'd be good to add some test cases for multiline messages with @deprecated
to capture whether they work/don't work, and make sure that the final formatting is correct.
class Foo {} | ||
// ^^^ definition diagnostics 0.0.1 `index.ts`/Foo# | ||
// diagnostic Information: | ||
// > This class is deprecated |
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 don't have a strong feeling on this (we can change it later), but I'm wondering if it makes sense to emit this at the definition site as well. What does the Dart indexer do? I'm thinking of downstream functionality, and it generally doesn't make sense to flag warnings for definitions that are deprecated, but only at usage sites.
Problem/Solution
Currently the diagnostics field on the reported index file is always empty, regardless on if the typescript indexer detects any diagnostic issues
This information can be especially helpful analysis of a codebase, where questions like "how many deprecations are being used within this package" are asked. This is something that we rely pretty heavily on in scip-dart use cases (which fully indexes all analyzer results)
This PR updates the scip-typescript indexer to start indexing
@deprecated
jsdoc comments, and assigns the correctDeprecated
diagnostic tag. EventuallyDiagnosticTag.Unnecessary
should be implemented, but this is less beneficial from my point of viewTest plan
A new
diagnostics
snapshot test was added. This include updating the snapshot generation to be in line with the results from the official scip clisnapshot
command: sourcegraph/scip#226