When accepting an autocomplete suggestion inside an empty if
statement, Cursor places the text before the if
block instead of inside the parentheses, breaking the code structure.
Here’s a video (GIF) of the bug happening:
To reproduce:
- Start writing React’s reducer function in TypeScript.
- Type
if (|)
where|
is the cursor. - Accept the autocomplete suggestion (e.g.,
action.type === "ADD_NEW_CYCLE"
) by pressing Tab. (Any other suggestion will do the same - Observe that the suggestion is inserted before the
if
, not inside the parentheses breaking the syntax.
Expected result:
The suggestion should appear inside the parentheses:
if (action.type === "ADD_NEW_CYCLE")