Skip to content

fix: handle UTF-16 diagnostics#906

Merged
graphite-app[bot] merged 1 commit into
mainfrom
codex/fix-utf16-diagnostics
Apr 24, 2026
Merged

fix: handle UTF-16 diagnostics#906
graphite-app[bot] merged 1 commit into
mainfrom
codex/fix-utf16-diagnostics

Conversation

@camc314

@camc314 camc314 commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Fixes #897

@camc314 camc314 self-assigned this Apr 24, 2026
@camc314 camc314 marked this pull request as ready for review April 24, 2026 19:21
Copilot AI review requested due to automatic review settings April 24, 2026 19:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes a crash in the tsgolint CLI diagnostic printer when source files contain non-BMP characters (e.g., emoji), by avoiding invalid UTF-16 offset computations when deriving codebox slice boundaries.

Changes:

  • Update printDiagnostic to compute the codebox end position via scanner.GetECMAEndLinePosition (instead of manual column → UTF-16 offset conversion).
  • Fix off-by-one / out-of-bounds conditions when determining whether a diagnostic start/end falls within the current line.
  • Add a regression test ensuring diagnostics can be printed for a source line containing UTF-16 characters.

Reviewed changes

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

File Description
cmd/tsgolint/main.go Adjusts diagnostic codebox boundary computation and fixes line-boundary checks to prevent panics.
cmd/tsgolint/main_test.go Adds a regression test covering UTF-16 characters in diagnostic output generation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

camc314 commented Apr 24, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

@graphite-app graphite-app Bot force-pushed the codex/fix-utf16-diagnostics branch from 48a0746 to 3858f4d Compare April 24, 2026 19:31
@graphite-app graphite-app Bot merged commit 3858f4d into main Apr 24, 2026
9 checks passed
@graphite-app graphite-app Bot deleted the codex/fix-utf16-diagnostics branch April 24, 2026 19:38
@graphite-app graphite-app Bot removed the 0-merge label Apr 24, 2026
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.

UTF-16 crashes

2 participants