Skip to content

Use JSDoc directly in syntactic classifier rather than reparsing #52795

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

Closed
wants to merge 1 commit into from

Conversation

jakebailey
Copy link
Member

@jakebailey jakebailey commented Feb 16, 2023

Fixes #47537

This is an alternative to #52710 which instead solves the issue by not reparsing the JSDoc, instead using the JSDoc that's already parsed in the tree.

Perhaps this is unwise, as:

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Feb 16, 2023
@jakebailey jakebailey changed the title Use JSDoc directly in old classifier rather than reparsing Use JSDoc directly in syntactic classifier rather than reparsing Feb 16, 2023
@jakebailey
Copy link
Member Author

Turns out I was confused, this is the syntactic classifier and not the semantic classifier, so it's not "old". But, VS Code doesn't use this thing, so, I'm still not sure who does.

Comment on lines +765 to +766
const text = sourceFile.text.substr(start, 3);
if (text === "/**") {
Copy link
Member

@DanielRosenwasser DanielRosenwasser Feb 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately substr allocates so:

Suggested change
const text = sourceFile.text.substr(start, 3);
if (text === "/**") {
const sourceText = sourceFile.text;
if (start + 3 <= sourceText.length && sourceText.charCodeAt(start) === CharacterCodes.slash
&& sourceText.charCodeAt(start + 1) === CharacterCodes.asterisk && sourceText.charCodeAt(start + 2) === CharacterCodes.asterisk) {

@jakebailey
Copy link
Member Author

I think this is the wrong fix anyway; please review #52710 instead.

@jakebailey jakebailey closed this Mar 10, 2023
@jakebailey jakebailey deleted the fix-47537-redo branch March 18, 2023 04:13
@jakebailey jakebailey restored the fix-47537-redo branch March 18, 2023 04:18
@jakebailey jakebailey deleted the fix-47537-redo branch March 15, 2024 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Debug Failure in invalid JSDoc type expression
3 participants