Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix getTokenAtPos in JSDoc trivia position#2371

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
gabritto wants to merge2 commits intomain
base:main
Choose a base branch
Loading
fromgabritto/fix_jsdoc_tokenAtPos

Conversation

@gabritto
Copy link
Member

Fixes#2290.

We were scanning into an AST node ingetTokenAtPosition, basically because in this JSDoc case:

/** *@type {{ * 'string-property': boolean; */*$*/identifierProperty:boolean;*}}*/varsomeVariable;

identifierProperty's positiondoes not include what would typically be its leading trivia. So the positions between the starting* andidentifierProperty effectively don't belong to any node or token in the AST, butgetTokenAtPosition operated under the assumption that this was impossible, and therefore that we should scan and find a non-tree token in between* andidentifierProperty.

I added code to explicitly track what the next AST node is (nodeAfterLeft) whenever we update the scanner starting position (left), so we can then enforce the invariant of scanning only in between AST nodes.

@jakebaileyjakebailey mentioned this pull requestDec 13, 2025
@ahejlsberg
Copy link
Member

@gabritto See my commenthere.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotAwaiting requested review from CopilotCopilot will automatically review once the pull request is marked ready for review

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Crash for completions after JSDoc* on line following string-named property signature

3 participants

@gabritto@ahejlsberg

[8]ページ先頭

©2009-2025 Movatter.jp