Skip to content

Fixed a crash when reformatting JsxNamespacedName#2989

Merged
DanielRosenwasser merged 3 commits intomicrosoft:mainfrom
Andarist:fix/jsx-namespace-update-crash
Mar 5, 2026
Merged

Fixed a crash when reformatting JsxNamespacedName#2989
DanielRosenwasser merged 3 commits intomicrosoft:mainfrom
Andarist:fix/jsx-namespace-update-crash

Conversation

@Andarist
Copy link
Contributor

@Andarist Andarist commented Mar 5, 2026

fixes a crash found here: #2988 (comment)

Comment on lines -4210 to -4217
lines := strings.Split(script.content, "\n")
lineNum := int(f.currentCaretPosition.Line)
if lineNum >= len(lines) {
t.Fatalf("Current line %d is out of range (file has %d lines)", lineNum, len(lines))
}
actualLine := lines[lineNum]
// Handle \r if present
actualLine = strings.TrimSuffix(actualLine, "\r")
Copy link
Member

Choose a reason for hiding this comment

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

I think @DanielRosenwasser recently look at code like this

Copy link
Member

@DanielRosenwasser DanielRosenwasser Mar 5, 2026

Choose a reason for hiding this comment

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

Copy link
Member

@DanielRosenwasser DanielRosenwasser left a comment

Choose a reason for hiding this comment

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

Nice catch thanks!

@DanielRosenwasser DanielRosenwasser added this pull request to the merge queue Mar 5, 2026
Merged via the queue into microsoft:main with commit fdb570c Mar 5, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants