Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical bug causing a panic in the linter when processing JavaScript files that utilize JSDoc type annotations. The core issue stemmed from the GetChildren utility function incorrectly handling reparsed JSDoc nodes, leading to inconsistencies in the token cache. The solution involves modifying GetChildren to properly ignore these specific nodes, thereby preventing the crash and ensuring stable linting for JSDoc-annotated code. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses a panic that occurs when linting JavaScript files containing JSDoc type annotations. The fix correctly skips reparsed JSDoc nodes within the GetChildren function by checking for the NodeFlagsReparsed flag, which prevents token cache mismatches. The change is minimal, well-targeted, and is accompanied by a comprehensive new test suite that covers a wide variety of JSDoc use cases, ensuring the fix is robust. The implementation appears correct and effectively resolves the reported issue.
09af6fe to
a56eb67
Compare
…panic (#364) GetChildren did not filter out NodeFlagsReparsed nodes when collecting children via ForEachChild. JSDoc annotations (@type, @Satisfies, etc.) create reparsed nodes whose positions point into JSDoc comment ranges rather than the actual code range. This caused the gap-filling scanner to produce tokens overlapping with real code tokens, triggering a "Token cache mismatch: parent" panic in GetOrCreateToken. The fix skips reparsed children in GetChildren, consistent with how the upstream typescript-go handles them in astnav and ls/lsutil.
a56eb67 to
5070826
Compare
Summary
@type,@satisfies,@param,@typedef,@callback,@overload, etc.)GetChildrendid not filter outNodeFlagsReparsednodes created by the parser's JSDoc reparsing. These reparsed nodes have positions pointing into the JSDoc comment range rather than the actual code range, causing the gap-filling scanner to produce overlapping tokens with different parents, which triggers aToken cache mismatch: parentpanic inGetOrCreateTokenNodeFlagsReparsedflag inGetChildren, consistent with how upstream typescript-go handles them inastnav/tokens.goandls/lsutil/children.goRelated Links
Checklist