Skip to content

Inconsistent Auto-Closing and Deletion for JSX/TSX Props #330523

Description

@monolithed

Does this issue occur when all extensions are disabled?: Yes/No

VS Code Version: 1.132.1
OS Version: Sonoma 14.0 (23A344)

Steps to Reproduce:

  1. Start typing a prop name in a JSX/TSX component.
  2. VS Code shows an autocomplete suggestion with a default value.
  3. Press Enter/Tab to accept the suggestion.

Actual Behavior:

Case 1 — Boolean props:

  1. After accepting the suggestion, the prop name is inserted. You manually type={ 👎
  2. When you press Delete on {|}, both braces are removed together 👍

Example: wrap={|}deletewrap=| 👍

Case 2 — String props

  1. After accepting the suggestion, VS Code automatically inserts ="|" 👍
  2. When you press Delete on "|", only the closing quote is removed, leaving the opening quote 👎

Example: align=""deletealign=|" 👎

qdwqdw.mov

Expected Behavior:

  1. For boolean props: ={} should be automatically added after accepting the suggestion (just like ="" is automatically added for strings).

  2. For string props: When pressing Delete on "", both quotes should be removed together (just like braces are removed for booleans)

This issue might go unnoticed if VS Code allowed different quote styles for TSX and TS files. Currently, the quote setting applies globally, forcing developers to constantly delete and re-type quotes on string props in TSX, which makes the inconsistent deletion behavior much more noticeable and frustrating.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions