-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Completion ListsThe issue relates to showing completion lists in an editorThe issue relates to showing completion lists in an editorFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
TypeScript Version: 3.0.0-dev.20180713
Search Terms:
- isNewIdentifierLocation
- completions
- suggest
Bug
The completionInfo
request seems to always return isNewIdentifierLocation
when inside a function call such as:
console.log(c|)
Expected behavior:
I believe that isNewIdentifierLocation
should only be returned when the user is starting to write a arrow function with a parenthesized parameter list, such as:
(c|)
or
console.log((c|)
svipas and highco
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Completion ListsThe issue relates to showing completion lists in an editorThe issue relates to showing completion lists in an editorFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Activity
ghost commentedon Jul 16, 2018
The problem is that
c => c + 1
is also a syntactically valid arrow function. So when the user typesc
, we wouldn't want to automatically correct it to something that happened to start withc
.One option might be to return three results: definitely not a new identifier, probably a new identifier, and probably not a new identifier. Then the editor could avoid making leaps of corrections, but still correct obvious spelling mistakes.
mjbvz commentedon Jul 16, 2018
@Andy-MS One case we are interested in here is whether to enable accepting completions on
,
or not. I think,
should commit forc|
when the user is going to typec => c + 1
but not for(c|)
in(c) => c + 1
I think we could do this with the extra information you are proposing
highco commentedon Jan 14, 2019
The bug is still present in TypeScript 3.2.2. It's quite annoying, because in all IDEs, the autocomplete match doesn't get inserted in situation where you would expect it to be inserted.
I think the value of
isNewIdentifierLocation
should depend upon whether an arrow function is valid at the current location. For example:isNewIdentifier
is true #59523