Better completions in incomplete constructs#2396
Merged
Merged
Conversation
…structs Conflicts: src/services/formatting/smartIndenter.ts
Conflicts: src/services/formatting/smartIndenter.ts src/services/services.ts
Contributor
|
Can we add a few tests on the end of a node, e.g // no a or b
function f (a, b) {}/*here*/// should see a and b
foo((a, b)=>a,/*here*/// no "i"
for (let i =0; i < 10; i++) i;/*here*/ // no a or b
/*here*/function f (a, b) {} // no a or b
/*here*/(a, b)=> {} |
Contributor
There was a problem hiding this comment.
Why we no longer need to check if completions.entries is defined?
Member
Author
There was a problem hiding this comment.
My understanding is completions can be undefined but entries is non-optional. Can @mhegazy weigh in on the accuracy of this?
Member
Author
There was a problem hiding this comment.
This seems to be the case.
Contributor
|
👍 |
DanielRosenwasser
added a commit
that referenced
this pull request
Mar 18, 2015
…ucts Better completions in incomplete constructs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR uses a different mechanism for getting the scope of completion by looking at the context token (here called the
previousToken). We then climb up the AST through parent references from that token and find a node that "embraces"/"encompasses" the current position. The logic is shared (i.e. ripped out of) the smart indenter and augmented to be more complete.Fixes #1410, #1429, #1674, and #2292.