feat(editor): Rainbow brackets and semantic highlighting (rainbow variables) (#59)

Two editor toggles under Settings › Editor › Color Scheme › Language Defaults (off by default, also actions `editor.toggleRainbowBrackets` / `editor.toggleSemanticHighlighting`):
- Semantic highlighting (IDEA's rainbow variables): locals and parameters coloured by a name hash from LSP semantic tokens; fields, statics, constants, library symbols untouched.
- Rainbow brackets (VS Code's bracket pair colorization): (), [], {} by depth, unmatched in the error colour, strings/comments skipped, visible ranges only with 4 KB checkpoints.
Palettes are theme tokens (`--syn-rainbow-1..5`, `--syn-bracket-1..3`, light/dark/high-contrast), editable in the Color Scheme tree, and mapped from IntelliJ `.icls` RAINBOW_COLOR1..5.

App verification on macOS found the colours were overridden by the syntax highlighter's span nested inside the marks; the rules now cover descendants. Verified both toggles on/off live in a TS file.

Fixes #56

https://claude.ai/code/session_01VUYsdXA2nkF5v6zsC93dpn
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-10-27 11:52:07 +08:00
1 джерело 2e0c74e31d
коміт beab7992f9
17 files changed
+679 -9

No files matched your search

+2
Переглянути файл
@@ -94,6 +94,8 @@ export const ATTRIBUTES: readonly AttributeDef[] = [
syn("operator", "Braces and Operators", [LD], "punct"),
syn("markupTag", "Markup › Tag", [LD], "tag"),
syn("markupAttribute", "Markup › Attribute", [LD], "attribute"),
...[1, 2, 3, 4, 5].map((n) => syn(`semantic${n}`, `Semantic highlighting › Color ${n}`, [LD], `rainbow-${n}`)),
...[1, 2, 3].map((n) => syn(`bracket${n}`, `Rainbow brackets › Level ${n}`, [LD], `bracket-${n}`)),
syn("pySelf", "Self parameter", ["Python"], "self"),
syn("pyKeywordArg", "Keyword argument", ["Python"], "keyword-arg"),
+4
Переглянути файл
@@ -52,6 +52,10 @@ export function lineCommentStyleFor(prefs: EditorExtras, language: string | unde
export const EDITOR_EXTRA_DEFAULTS = {
colorOverrides: {} as Record<string, Record<string, TextAttributesOverride>>,
/** Color Scheme › Language Defaults › Semantic highlighting (rainbow locals / parameters). */
semanticHighlighting: false,
/** Color Scheme › Language Defaults › Rainbow brackets. */
rainbowBrackets: false,
ligatures: false,
fallbackFont: "",
/** Typography Settings › Main / Bold font weight (CSS weights, IDEA's Regular / Bold). */