Skip to content

No completions on meta-properties #23326

Closed

Description

class C {
  constructor() {
    new./**/
  }
}

Expected: Completion for the target keyword at the /**/ marker.
Actual: No completions.

Activity

  1. added
    Bug
    Domain: LS: Completion Lists
    on Apr 10, 2018
  2. added this to the milestone on Apr 10, 2018
  3. DanielRosenwasser commented on Apr 10, 2018

    @DanielRosenwasser
    MemberAuthor

    Ideally, any work here will make it easy to add completion support for import.meta.

  4. Gregjarvez commented on Apr 12, 2018

    @Gregjarvez

    Yayy first issue 😀😀 with some support I would like to tackle this issue
    https://github.com/Microsoft/TypeScript/blob/a004571d3ebb7da6a7d0915465829dee9874e495/src/services/completions.ts#L2113
    would this be the right place to edit
    Daniel Rosenwasser (@DanielRosenwasser)

  5. DanielRosenwasser commented on Apr 12, 2018

    @DanielRosenwasser
    MemberAuthor

    Hey Gregory Assasie (@Gregjarvez), awesome! I would actually look closer into:

    https://github.com/Microsoft/TypeScript/blob/a004571d3ebb7da6a7d0915465829dee9874e495/src/services/completions.ts#L1012

    In that function, I'd check if node is a meta-property.

    https://github.com/Microsoft/TypeScript/blob/0feefab765214f080e5d8db37bde42830a1c8884/src/compiler/utilities.ts#L5050

    Then, if the the meta-property keyword is new, I'd serve up a single completion for the text target.

    Tests can be written in tests/cases/fourslash, and you can take inspiration from other completions-related tests.

  6. Gregjarvez commented on Apr 12, 2018

    @Gregjarvez

    Pardon me for the questions and many more to come , I am new here

    with regards to this statement I'd serve up a single completion for the text target.
    what is the text target

    Also does this /**/ marker have a special meaning should know about

    Thank you :)

  7. DanielRosenwasser commented on Apr 12, 2018

    @DanielRosenwasser
    MemberAuthor

    I'm saying that when you have the text new. in your file and a user requests completions, you should provide the "target" as one of the suggestion items, because the user intends to write new.target.

    Also does this /**/ marker have a special meaning should know about

    In fourslash tests, we have functionality for emulating the way a user would type code. You type in code preceded by four slashes, and the testing infrastructure interprets that as a file. The testing infrastructure also knows that within those four slashes, /**/ is what's called a "marker comment".

    You can then call functions to work with the file, and jump to those markers. For example, here's how I'd write a test for new.target in tests/cases/fourslash/completionsNewTarget.ts

    /// <reference path="fourslash.ts" />
    
    ////class C {
    ////    constructor() {
    ////        if (C === new./**/)
    ////    }
    ////}
    
    goTo.marker("");
    verify.completionListContains("target");
    verify.completionListCount(1);
  8. modified the milestones: , TypeScript 3.0 on May 24, 2018
  9. added
    Fixed
    on May 24, 2018
  10. locked and limited conversation to collaborators on Jul 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugDomain: LS: Completion ListsFixed

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions