Skip to content

isNewIdentifierLocation is always set to true inside function call #25691

Closed

Description

@mjbvz

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|)

Activity

  1. mjbvz commented on Jul 16, 2018

    @mjbvz
    ContributorAuthor

    Andy (Andrewkraft) (@Andy-MS) One case we are interested in here is whether to enable accepting completions on , or not. I think , should commit for c| when the user is going to type c => c + 1 but not for (c|) in (c) => c + 1

    I think we could do this with the extra information you are proposing

  2. added
    Domain: LS: Completion Lists
    on Jul 16, 2018
  3. ghost added
    Fixed
    on Jul 16, 2018
  4. ghost removed this from the TypeScript 3.1 milestone on Sep 18, 2018
  5. ghost added this to the TypeScript 3.2 milestone on Sep 18, 2018
  6. ghost removed this from the TypeScript 3.2.1 milestone on Nov 16, 2018
  7. ghost added this to the TypeScript 3.3 milestone on Nov 16, 2018
  8. Repository owner unassigned on Nov 16, 2018
  9. highco commented on Jan 14, 2019

    @highco

    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:

    function demo(a:number, b:(x:number) => void)
    {
    }
    
    demo(a|     // an arrow function isn't valid here, isNewIdentifierLocation should be false
    demo(a, b|  // an arrow function is valid here, isNewIdentifierLocation should be true
    
  10. added
    Fix Available
    on Jul 15, 2019
  11. removed
    Fixed
    Fix Available
    on Aug 6, 2024
  12. added
    Fix Available
    on Aug 6, 2024
  13. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugDomain: LS: Completion ListsFix Available

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions