-
Notifications
You must be signed in to change notification settings - Fork 12.9k
[Master] fix 16407 - LS in binding element of object binding pattern #16534
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
Conversation
f9dec04
to
3926c50
Compare
I've iterated on yui's change - it no longer changes how we match up symbols in the checker, as that was breaking flow control analysis. Now, it does for object binding patterns a similar action as it does for property names in an object literal. The baseline changes are now nonexistent, and it is just new services functionality. |
src/services/goToDefinition.ts
Outdated
@@ -76,6 +76,26 @@ namespace ts.GoToDefinition { | |||
declaration => createDefinitionInfo(declaration, shorthandSymbolKind, shorthandSymbolName, shorthandContainerName)); | |||
} | |||
|
|||
// If the node is an identifier in bindingelement of ObjectBindingPattern (Note: ArrayBindingPattern can only declaration) |
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.
Would you mind rephrasing this a little? I find it a bit hard to follow.
src/services/goToDefinition.ts
Outdated
// pr/*destination*/op1: number | ||
// } | ||
// bar<Test>(({pr/*goto*/op1})=>{}); | ||
if (isPropertyName(node) && isBindingElement(node.parent) && isObjectBindingPattern(node.parent.parent) && (node.parent.propertyName ? node.parent.propertyName === node : node.parent.name === node)) { |
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.
Alternatively, node === (node.parent.propertyName || node.parent.name)
.
266c208
to
7f568c3
Compare
@amcasey done |
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.
LGTM
Fix #16407
Because identifier in bindingElement in objectBindingPattern is considered declaration name, previously it will just return its symbol. So when perform goto-definition, it will simply just stay where it is
However, it is desirable to actually goto the
prop2
in an interface. See: master...master-fix16407#diff-3c46922136bdd65e7a2c2d12db87bbe5....