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
Don’t offer import statement completions at from
position
#44125
Don’t offer import statement completions at from
position
#44125
Conversation
@@ -183,6 +185,20 @@ namespace ts.Completions { | |||
return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries }; | |||
} | |||
|
|||
function specificKeywordCompletionInfo(keywords: readonly SyntaxKind[]): CompletionInfo { |
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.
src/services/completions.ts
Outdated
@@ -183,6 +185,20 @@ namespace ts.Completions { | |||
return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries }; | |||
} | |||
|
|||
function specificKeywordCompletionInfo(keywords: readonly SyntaxKind[]): CompletionInfo { | |||
return { | |||
isGlobalCompletion: 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.
I tried making this false
but the snippets for for
loops and stuff still showed up 🤔
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.
Should it be false
then?
@mjbvz any idea why that might be happening?
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.
Set to false
now despite seeing no difference locally
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.
Seems right, but I feel like you should specify isGlobalCompletions
as false
(or at least get clarity on behavior), and you could also just switch to a cheaper lookup for name
.
Once that's done, we can cherry-pick into release-4.3.
@typescript-bot cherry-pick this to release-4.3 |
Heya @andrewbranch, I've started to run the task to cherry-pick this into |
Hey @andrewbranch, I've opened #44136 for you. |
❗ Hoping to get this fix into for 4.3. The current state is pretty disruptive if your muscle memory expects a completion for
from
but you get an import completion instead.Fixes this:
By making it this: