Skip to content

jsx automatic brace insertion does not work if you have already started typing attribute value  #21578

@mjbvz

Description

@mjbvz

TS Version: 2.7.1

Search Terms:

  • jsx
  • insertText
  • brace attribute

Code

const onClick = () => { };

<button onClick=o />

Trigger auto complete at end of o in onClick=o

Expected behavior:
Accepting suggestion for onClick inserts: <button onClick={onClick} />

Actual behavior:
Only inserts property name: <button onClick=onClick />

Here's the returned completion entry:

  {
        "name": "onclick",
        "kind": "var",
        "kindModifiers": "declare",
        "sortText": "0"
    }

This works if you trigger suggestions for onClick=| and then start typing:

 {
        "name": "onclick",
        "kind": "var",
        "kindModifiers": "declare",
        "sortText": "0",
        "insertText": "{onclick}"
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Completion ListsThe issue relates to showing completion lists in an editorFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions