Skip to content

Autocomplete parentheses, arrow functions #1574

Open

Description

@cedrikaagaard

The "Autocomplete parentheses" option doesn't work for arrow functions and this would be a nice feature to have.

Activity

  1. lierdakil commented on Mar 1, 2021

    @lierdakil
    Collaborator

    It would be, but I don't know how to fix this. TSServer reports bound array functions as const, which they are. And parsing the info it returns about type is probably not very robust. Here's an example:

    {
      "name": "test",
      "kindModifiers": "",
      "kind": "const",
      "displayParts": [
        {
          "text": "const",
          "kind": "keyword"
        },
        {
          "text": " ",
          "kind": "space"
        },
        {
          "text": "test",
          "kind": "localName"
        },
        {
          "text": ":",
          "kind": "punctuation"
        },
        {
          "text": " ",
          "kind": "space"
        },
        {
          "text": "(",
          "kind": "punctuation"
        },
        {
          "text": ")",
          "kind": "punctuation"
        },
        {
          "text": " ",
          "kind": "space"
        },
        {
          "text": "=>",
          "kind": "punctuation"
        },
        {
          "text": " ",
          "kind": "space"
        },
        {
          "text": "void",
          "kind": "keyword"
        }
      ],
      "documentation": []
    }

    That's pretty much all we can coax out of tsserver. I don't know how to decide whether we need to add parentheses or not based off this. If anyone has suggestions -- feel free to chime in.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions