Fix JSX linked editing for incomplete property tags with attributes - #64643
Open
Musa Toktas (musatoktas) wants to merge 1 commit into
Open
Musa Toktas (musatoktas) wants to merge 1 commit into
Musa Toktas (musatoktas) wants to merge 1 commit into
Conversation
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
Contributor
|
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
Contributor
There was a problem hiding this comment.
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.
Author
|
@microsoft-github-policy-service agree |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #56669.
Deleting
Bfrom<A.B foo="bar"></A.B>leaves<A. foo="bar"></A.>. The parser currently consumesfooas 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:
tscGo packages passed, including all fourslash and compiler tests. The initialgo -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, andcheck:formatpassed.@typescript/typescriptandnative-previewpackage builds, both Go modules'mod tidy -diffchecks, andgo work syncpassed. 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.