CodeEditSourceEditor icon indicating copy to clipboard operation
CodeEditSourceEditor copied to clipboard

✨ Autocomplete angle bracketed components the same way braces are autocompleted

Open knotbin opened this issue 2 months ago • 5 comments

Description

When a user uses angle brackets with a component, for instance typing <div>, and then presses enter, the system autocompletes that component, adding </div> on the line below the new current line and indents the new current line.

Alternatives Considered

No response

Additional Context

No response

Screenshots

Screenshot 2024-04-27 at 2 10 06 PM

knotbin avatar Apr 27 '24 18:04 knotbin

This should probably only apply to html, xml, and jsx. It should work like this…

  1. User types < - no autocomplete occurs
  2. User types tag name, <div - no autocomplete occurs
  3. User types >, <div> - closing tag is autocomplete and is inserted directly after the opening tag. Cursor is placed in between tags. Eg. <div>|</div>
  4. If user presses return, closing tag is moved to a new line, then cursor is placed on a new empty line and indented in between the other two lines. Eg…
<div>
    |
</div>

[!NOTE] Tag attributes should be ignored and not put in the closing tag. Eg. <div class="panel"></div>

austincondiff avatar Apr 28 '24 15:04 austincondiff

In addition to JSX and TSX, it should also apply to regular JS and TS files as JSX and TSX can be written inside regular JS and TS files.

knotbin avatar Apr 28 '24 16:04 knotbin