fix(highlights): prevent gray decoration box in Cursor - #7
Merged
Merged
Conversation
Co-locate borderRadius with the border/background it rounds in the light/dark theme objects and inject a transparent background whenever a glass theme carries a border or borderRadius without an explicit one. This stops Cursor from painting a fallback gray box on the decoration base rule (microsoft/vscode#175819, wayou/vscode-todo-highlight#434). VS Code appearance is unchanged. Fixes #1 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
# Conflicts: # agent/tasks.md # agent/timeline.md # src/highlights.js
# Conflicts: # agent/tasks.md # agent/timeline.md
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 #1
Problem
In Cursor (a VS Code fork) the default
neon+glasstag highlight rendered a solid gray rounded background block. In VS Code the identical config renders the intended translucent "glass" box (faint tint + colored border, rounded corners). The reporter noted thetodo-highlightextension had the same problem in Cursor.Root cause
Known VS Code/Cursor decoration behavior (
microsoft/vscode#175819,wayou/vscode-todo-highlight#434): aTextEditorDecorationTypethat carriesborder+borderRadiuswithout an explicit, co-locatedbackgroundColormakes the editor paint a default fallback background — which renders gray in dark themes. Cursor exhibits this; stock VS Code currently does not.buildGlassDecorationOptionsinsrc/highlights.jsputborderRadiuson the decoration's base rule whilebackgroundColor/borderlived only in thelight/dark(theme-scoped) rules. The base rule therefore hadborder-radiuswith no background, so Cursor gray-filled it. This also matches the repo's owndebugging_journal.mdlesson about not splitting style props between the top level and thelight/darksub-objects.Glass is the only decoration carrying border/radius (
buildTextDecorationOptions,getSubTagDecoration,buildMetaDecorationOptionsset neither), so the fix is isolated.Fix
Rewrite
buildGlassDecorationOptionsso each themed object is a self-contained glass box:borderRadiusintolight/darknext to the border (dropped from the top level).borderRadiusis a validThemableDecorationRenderOptionsproperty, so this is API-safe and visually identical in VS Code.backgroundColoron any themed object that has aborder/borderRadius; when the config supplies none, fall back totransparent(the documented upstream workaround).The default
neon+glasstranslucent tint is preserved, so VS Code's appearance is unchanged; the transparent fallback only protects border-only/custom configs. The four-channel model, range types, and opacity controls are untouched.Tests
test/highlights.decorations.tests.js(5 behavioral tests) asserts: no top-levelborderRadius;borderRadiusco-located with the border inlight/dark; transparent fallback for border-only configs; the invariant that no glass theme has a border/borderRadius without an explicit background; and background-only configs are untouched._buildGlassDecorationOptionsis exported for testing (mirrors existing_-prefixed test exports).Verification
npx qunit test/highlights.decorations.tests.js→ 5 passingnpm test→ 124 passing (119 baseline + 5 new), 0 failingnpm run webpack→ success