Skip to content

Fix JSX linked editing for incomplete property tags with attributes - #64643

Open
Musa Toktas (musatoktas) wants to merge 1 commit into
microsoft:mainfrom
musatoktas:fix/56669-jsx-linked-editing
Open

Musa Toktas (musatoktas) wants to merge 1 commit into
microsoft:mainfrom
musatoktas:fix/56669-jsx-linked-editing

Conversation

@musatoktas

Copy link
Copy Markdown

Fixes #56669.

Deleting B from <A.B foo="bar"></A.B> leaves <A. foo="bar"></A.>. The parser currently consumes foo as part of the opening tag name, losing the matching JSX element and its linked editing ranges.

When whitespace after a JSX tag's dot is followed by an attribute assignment, recover with a missing property identifier and leave the attribute for the JSX attribute parser. Valid property names separated by whitespace continue to parse normally. This also handles hyphenated and namespaced attribute names.

Adds linked-editing regression coverage for TSX and JSX, string and expression attributes, keyword/hyphenated/namespaced attributes, nested property names, multiline and spread attributes, valid spaced property names, and mismatched tags. The original reproduction fails on the unmodified main commit.

Validation on Linux with Go 1.27.0, Node 24.21.0, and npm 11.19.1:

  • The original regression test fails before the fix at main commit 50d70a3.
  • All tsc Go packages passed, including all fourslash and compiler tests. The initial go -C tsc test -p=4 -parallel=4 -count=1 ./... run reached the test host's five-minute limit; the remaining packages passed in a second batch, and the combined results cover every package.
  • npx hereby generate, build, lint, and check:format passed.
  • The extension, tools, and API tests, Go benchmarks and API benchmarks passed via their individual Hereby tasks.
  • The @typescript/typescript and native-preview package builds, both Go modules' mod tidy -diff checks, and go work sync passed. Generation and these checks produced no additional tracked changes.

AI assistance: Codex was used to investigate this issue, implement the parser change, and prepare and run the tests.

Recover an attribute assignment after a trailing JSX tag dot without consuming the attribute name as a property. Cover matching ranges, JSX/TSX attributes, valid spaced property names, and mismatched tags.

Fixes microsoft#56669
Copilot AI balanced review requested due to automatic review settings October 5, 2026 14:54
@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Oct 5, 2026
@typescript-automation

Copy link
Copy Markdown
Contributor

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

@musatoktas Musa Toktas (musatoktas) added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Oct 5, 2026
@typescript-automation typescript-automation Bot added For Backlog Bug PRs that fix a backlog bug and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Oct 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused parser recovery is well-scoped and covered by comprehensive regression cases.

Review effort: Balanced
Findings: None

What changed in this PR

Recovers incomplete JSX property tags so linked editing remains available when followed by assigned attributes.

Changes:

  • Preserves attribute tokens after incomplete dotted tag names.
  • Adds TSX/JSX linked-editing regression coverage across attribute forms and edge cases.
File Description
tsc/​internal/​parser/​parser.go Adds JSX parser recovery for incomplete property tags.
tsc/​internal/​fourslash/​tests/​linkedEditingJsxTagIncompleteProperty_test.go Tests linked editing and parser recovery scenarios.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@musatoktas

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

This branch has not been deployed

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

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

Mirror cursor for JSX stops working in some case

2 participants