-
Notifications
You must be signed in to change notification settings - Fork 12.8k
fix(53138): go-to-definition not working on expression of SatisfiesExpression #53164
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
fix(53138): go-to-definition not working on expression of SatisfiesExpression #53164
Conversation
//////somewhere in app | ||
////STRINGS.[|/*usage*/title|] | ||
|
||
// verify.goToDefinition("usage", "definition"); |
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.
Is this leftover?
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.
Yep, removed.
@@ -0,0 +1,14 @@ | |||
/// <reference path="./fourslash.ts"/> | |||
|
|||
// @noImplicitOverride: true |
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.
What is this doing?
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's copied from other files accidentally.
src/services/goToDefinition.ts
Outdated
@@ -274,8 +274,9 @@ function getDefinitionFromObjectLiteralElement(typeChecker: TypeChecker, node: N | |||
if (element) { | |||
const contextualType = element && typeChecker.getContextualType(element.parent); | |||
if (contextualType) { | |||
return flatMap(getPropertySymbolsFromContextualType(element, typeChecker, contextualType, /*unionSymbolOk*/ false), propertySymbol => | |||
const definitions = flatMap(getPropertySymbolsFromContextualType(element, typeChecker, contextualType, /*unionSymbolOk*/ false), propertySymbol => |
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.
This seems okay, though, I half wonder if it's better to change this to always return an empty array, then fix the one caller who cares about undefined
to check length instead. Maybe Andrew has further comments here.
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 read the usage--you'll have to write the code once somewhere, but moving it to the caller allows the other caller to be simplified, since it is getDefinitionFromObjectLiteralElement(checker, node) || []
right now. I vote to make this change.
src/services/goToDefinition.ts
Outdated
@@ -274,8 +274,9 @@ function getDefinitionFromObjectLiteralElement(typeChecker: TypeChecker, node: N | |||
if (element) { | |||
const contextualType = element && typeChecker.getContextualType(element.parent); | |||
if (contextualType) { | |||
return flatMap(getPropertySymbolsFromContextualType(element, typeChecker, contextualType, /*unionSymbolOk*/ false), propertySymbol => | |||
const definitions = flatMap(getPropertySymbolsFromContextualType(element, typeChecker, contextualType, /*unionSymbolOk*/ false), propertySymbol => |
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 read the usage--you'll have to write the code once somewhere, but moving it to the caller allows the other caller to be simplified, since it is getDefinitionFromObjectLiteralElement(checker, node) || []
right now. I vote to make this change.
I had to switch this to the baseline format -- I think maybe the non-baseline verifier got removed recently? |
Fixes #53138