fix(editor): honor semantic token scheme styles (#2098)

Semantic tokens ignored the background, weight, italic and effect set for them in Color Scheme; only syntax tokens honoured them. Semantic roles now use the same attributes as syntax tokens, package references get their own attribute and theme token, and modifier styles keep winning over role styles, including deprecated static fields.

Default rendering changes: semantic constants are italic, as Color Scheme already declared, and package references in the light theme use the editor text colour.

Siblings covered: find matches stay above token backgrounds, and Package reference has a preview sample in Color Scheme.

Co-authored-by: shohruh-genius <[email protected]>
Цей коміт міститься в:
Shohruh Ismoilovтаshohruh-genius authored and GitHub committed 2026-11-08 21:27:12 +08:00
1 джерело dc8efedf75
коміт a22c8decfc
16 files changed
+187 -48

No files matched your search

+9
Переглянути файл
@@ -73,6 +73,15 @@ describe("color schemes", () => {
});
});
it("resolves package references from the editor foreground and emits their overrides", () => {
for (const theme of ["light", "dark", "dark-hc"] as const) {
expect(resolvedAttribute(theme, "packageReference").foreground).toBe(schemeTokens(theme).get("--fg-editor"));
}
const css = schemeCss("dark", { dark: { packageReference: { foreground: "#446688", italic: true } } });
expect(css).toContain("--syn-namespace: #446688 !important");
expect(css).toContain("--syn-namespace-italic: italic !important");
});
it("emits scheme and override declarations", () => {
const root = document.documentElement;
root.dataset.theme = "light";
+1
Переглянути файл
@@ -125,6 +125,7 @@ const BASE_ATTRIBUTES: readonly AttributeDef[] = [
syn("identifier", "Identifiers › Local variable", [LD], "variable"),
syn("parameter", "Identifiers › Parameter", [LD], "param"),
syn("globalVariable", "Identifiers › Global variable", [LD], "global"),
syn("packageReference", "Identifiers › Package reference", [LD], "namespace"),
syn("constant", "Identifiers › Constant", [LD], "constant", { defaultItalic: true }),
syn("field", "Identifiers › Instance field", [LD], "property"),
{ id: "staticSymbol", name: "Identifiers › Static symbol", path: [LD], token: "static", italicOnly: true },
+1
Переглянути файл
@@ -2,6 +2,7 @@
"Cannot remove a worktree containing the open project.": "Cannot remove a worktree containing the open project.",
"Delete Remote Branches": "Delete Remote Branches",
"Delete the {length} branches '{names}' on the remote? The remote-tracking branches are removed as well.": "Delete the {length} branches '{names}' on the remote? The remote-tracking branches are removed as well.",
"Identifiers › Package reference": "Identifiers › Package reference",
"Add or Remove Caret": "Add or Remove Caret",
"Select Python Environment Folder": "Select Python Environment Folder",
"Checking interpreter": "Checking interpreter",
+1
Переглянути файл
@@ -1,4 +1,5 @@
{
"Identifiers › Package reference": "标识符 › 包引用",
"Cannot remove a worktree containing the open project.": "无法移除包含当前打开项目的工作树。",
"Select Python Environment Folder": "选择 Python 环境文件夹",
"Checking interpreter": "正在检查解释器",