Skip to content

Fix Debug Fail Go-to-def on JS class - #58204

Closed
Armando Aguirre (armanio123) wants to merge 3 commits into
microsoft:mainfrom
armanio123:FixGoToDefJsClass
Closed

Fix Debug Fail Go-to-def on JS class#58204
Armando Aguirre (armanio123) wants to merge 3 commits into
microsoft:mainfrom
armanio123:FixGoToDefJsClass

Conversation

@armanio123

Copy link
Copy Markdown
Contributor

// and in either case the symbol has a construct signature definition, i.e. class
if (symbol.flags & SymbolFlags.Class && !(symbol.flags & (SymbolFlags.Function | SymbolFlags.Variable)) && (isNewExpressionTarget(node) || node.kind === SyntaxKind.ConstructorKeyword)) {
const cls = find(filteredDeclarations, isClassLike) || Debug.fail("Expected declaration to have at least one class-like declaration");
const cls = find(filteredDeclarations, isClassLike) || getRightMostAssignedExpression(find(filteredDeclarations, isPropertyAccessExpression)?.parent as Expression) as ClassLikeDeclaration || Debug.fail("Expected declaration to have at least one class-like declaration");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

note that this change "competes" with #57628

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Thanks for noticing. I'll close this as I think yours makes more sense.

@gabritto

Copy link
Copy Markdown
Member

Nathan Shively-Sanders (@sandersn) do you have an opinion on whether we should accept this PR or #57628?

@microsoftMicrosoft (microsoft) locked as resolved and limited conversation to collaborators Oct 16, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ServerErrors][JavaScript] 5.5.0-dev.20240324

3 participants

@armanio123@gabritto@Andarist