Skip to content

Distinguishing suggestions from global scope from local suggestions #27487

Open

Description

@mjbvz

From microsoft/vscode#59437

Search Terms:

  • TSServer
  • completions
  • suggestions

Code
For the example ts file:

class FooClass {
    toString(): void {
        |
    }
}

Trigger suggestions at the | inside the toString method

Problem
We get back two completions from completionInfo:

     {
            "name": "toString",
            "kind": "function",
            "kindModifiers": "declare",
            "sortText": "0"
        },
        {
            "name": "toString",
            "kind": "method",
            "kindModifiers": "",
            "sortText": "0",
            "insertText": "this.toString"
        },

However when we then make the completionEntryDetails request, we can only pass the identifier name: "toString". This makes it unclear which completion entry we are actually requesting completion details for.

Proposal
completionEntryDetails already has a source field that is used to identify when a suggestion is an auto import. I believe that this field could also be used for global symbols, such as when a symbol name comes from a global lib.d.ts file. In this case, the first toString suggestion comes from a global in dom.d.ts

Activity

  1. RyanCavanaugh commented on Oct 1, 2018

    @RyanCavanaugh
    Member

    Andy (Andrewkraft) (@Andy-MS) interested in working out a solution here as part of the other completion item work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Experience EnhancementNoncontroversial enhancementsSuggestionAn idea for TypeScriptVS Code TrackedThere is a VS Code equivalent to this issue

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions