Skip to content

fix(oxc): align lint markers with the displayed source - #658

Draft
SaKaNa-Y wants to merge 1 commit into
vitejs:mainfrom
SaKaNa-Y:fix/oxc-lint-marker-position
Draft

SaKaNa-Y wants to merge 1 commit into
vitejs:mainfrom
SaKaNa-Y:fix/oxc-lint-marker-position

Conversation

@SaKaNa-Y

@SaKaNa-Y SaKaNa-Y commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

In Oxc Lint Inspector, a multibyte character before a diagnostic can move the underline to the right of the reported code. A multibyte character inside the marked text can make the underline too wide. Oxlint reports positions in UTF-8 bytes, and the inspector used each byte as one character cell.

The inspector now maps both ends of the byte range to the highlighted text saved with the lint run. It measures that text in the browser, draws the underline to fit and connects the rule label at the midpoint.

Evidence

Before: With twelve é characters before debugger;, the underline started 115.58 CSS pixels to the right of the statement.

The underline starts in blank space to the right of the debugger statement.

After: The underline matches both ends of debugger;. The underline for café, previously 9.66 CSS pixels too wide, also matches both ends.

The underline spans the debugger statement, including its semicolon.

In Chromium, all 12 nonempty spans matched the displayed text in both the full-page and embedded views. Reopening the saved run after editing the files preserved the original text and marker positions.

Merge Danger

Door: Two-way. The change only affects rendering. A revert needs no data migration.

Blast Radius: Oxc. Every lint result uses the same marker calculation. A positioning error can underline the wrong token even on a plain ASCII line. The shared highlighter also renders configuration previews.

Oxlint reports UTF-8 byte columns and lengths. Using those values as monospace character counts can move the underline past its token or extend it beyond the last letter.

Measure both byte endpoints against the highlighted source saved with the report. Use that range for the underline and its rule connector, including insertion points on empty lines.
@pkg-pr-new

pkg-pr-new Bot commented Dec 1, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools@658

@vitejs/devtools-kit

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-kit@658

@vitejs/devtools-oxc

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-oxc@658

@vitejs/devtools-rolldown

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-rolldown@658

@vitejs/devtools-vite

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-vite@658

@vitejs/devtools-vite-task

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-vite-task@658

@vitejs/devtools-vitest

npm i https://pkg.pr.new/vitejs/devtools/@vitejs/devtools-vitest@658

commit: 36b8312

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.

1 participant