-
Notifications
You must be signed in to change notification settings - Fork 13k
Fix crash when getting member completion for an object literal #853
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
@@ -2144,9 +2144,16 @@ module ts { | |||
} | |||
|
|||
// TODO: this is a hack for now, we need a proper walking mechanism to verify that we have the correct 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.
It's not really clear what is going on for someone running into the code for the first time. I didn't figure it out until I read the assertion. Please add a quick comment.
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 there a particular question you want answered? Basically, we start with a Fidelity node, and we have to find the corresponding AST node. @mhegazy said he is working on removing the Fidelity part, so that might make it clearer.
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.
Right, I just mean a quick comment explaining that we are trying to find corresponding AST nodes for fidelity nodes.
// declare function f(a: { xa: number; xb: number; }); | ||
// f({ | | ||
if (!fullTypeCheck) { | ||
if (candidates.length) { |
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.
candidates.length > 0
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.
actually I will just remove the check. it is a for loop after all. thanks.
👍 |
Fix crash when getting member completion for an object literal
The following code caused a crash:
This changes the find the relevant token at the beginning of getCompletionsAtPosition. This fixes the crash, but the following case still does not work:
This represents the next item to be done, which is making the type checker give us the right contextual type.