Skip to content

Unexpected completions returned for function inside object literal #38840

Closed
@mjbvz

Description

@mjbvz

From microsoft/vscode#98686

TypeScript Version: 4.0.0-dev.20200529

Search Terms:

  • completion
  • suggest / suggestions
  • completionInfo

Code
For the JS:

const z = {
  z: function() {}
}

Inside the function parens, type .

Bug
Completions are returned. Also isNewIdentifierLocation is set to false.

No completions are returned when you type . in a top level function

Here are the completions:

[Trace  - 07:24:46.568] <semantic> Sending request: completionInfo (284). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "/Users/matb/projects/san/index.jsx",
    "line": 2,
    "offset": 16,
    "includeExternalModuleExports": true,
    "includeInsertTextCompletions": true,
    "triggerCharacter": "."
}
[Trace  - 07:24:46.597] <semantic> Response received: completionInfo (284). Request took 29 ms. Success: true 
Result: {
    "isGlobalCompletion": false,
    "isMemberCompletion": true,
    "isNewIdentifierLocation": false,
    "entries": [
        {
            "name": "apply",
            "kind": "method",
            "kindModifiers": "declare",
            "sortText": "0"
        },
        {
            "name": "arguments",
            "kind": "property",
            "kindModifiers": "declare",
            "sortText": "0"
        },
        {
            "name": "bind",
            "kind": "method",
            "kindModifiers": "declare",
            "sortText": "0"
        },
        {
            "name": "call",
            "kind": "method",
            "kindModifiers": "declare",
            "sortText": "0"
        },
        {
            "name": "caller",
            "kind": "property",
            "kindModifiers": "declare",
            "sortText": "0"
        },
        {
            "name": "length",
            "kind": "property",
            "kindModifiers": "declare",
            "sortText": "0"
        },
        {
            "name": "name",
            "kind": "property",
            "kindModifiers": "declare",
            "sortText": "0"
        },
        {
            "name": "prototype",
            "kind": "property",
            "kindModifiers": "declare",
            "sortText": "0"
        },
        {
            "name": "toString",
            "kind": "method",
            "kindModifiers": "declare",
            "sortText": "0"
        },
        {
            "name": "z",
            "kind": "warning",
            "kindModifiers": "",
            "sortText": "6"
        }
    ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions