feat(color-scheme): split predefined types and functions and separate literal keywords (#4978)

Language Defaults and each language page get Identifiers › Predefined type and Predefined function next to Predefined symbol, and Literal keyword next to Keyword. The new entries show their parent until set, so existing overrides keep applying. true / false / null in the clike modes (Kotlin, Scala, Dart, Groovy, C#) are bool / null tokens taking Literal keyword instead of Constant.

Co-authored-by: wildcatDownstairs <[email protected]>
Цей коміт міститься в:
LU XIANGRUIтаwildcatDownstairs authored and GitHub committed 2026-11-22 00:07:39 +08:00
1 джерело a3dc3c99a6
коміт 9eaa44e004
9 files changed
+82 -17

No files matched your search

+25
Переглянути файл
@@ -106,6 +106,31 @@ describe("color schemes", () => {
expect(css).not.toMatch(/:root \{[^}]*--syn-decorator/);
});
it("splits Predefined symbol into types and functions and keeps literals apart from Constant (#4059)", () => {
for (const [child, parent] of [
["predefinedType", "predefined"],
["predefinedFunction", "predefined"],
["literalKeyword", "keyword"],
["kotlin.predefinedType", "kotlin.predefined"],
["kotlin.literalKeyword", "kotlin.keyword"],
] as const)
expect(resolvedAttribute("dark", child)).toEqual(resolvedAttribute("dark", parent));
expect(resolvedAttribute("dark", "kotlin.literalKeyword")).not.toEqual(
resolvedAttribute("dark", "kotlin.constant"),
);
// A language's Predefined symbol still reaches unset types and functions: they are not set on :root.
const css = schemeCss("dark", { dark: { "kotlin.predefined": { foreground: "#224466" } } });
expect(css).not.toContain("--syn-builtin-type");
const split = schemeCss("dark", {
dark: {
"kotlin.predefinedType": { foreground: "#bcbec4" },
"kotlin.predefinedFunction": { foreground: "#56a8f5" },
},
});
expect(split).toContain("--syn-builtin-type: #bcbec4 !important");
expect(split).toContain("--syn-builtin-function: #56a8f5 !important");
});
it("shows an unset Global function in the function declaration style, then its own (#4059)", () => {
const fn = resolvedAttribute("dark", "functionDeclaration");
expect(resolvedAttribute("dark", "javascript.globalFunction")).toEqual(fn);
+5
Переглянути файл
@@ -300,6 +300,8 @@ const BASE_ATTRIBUTES: readonly AttributeDef[] = [
},
syn("keyword", "Keyword", [LD], "keyword"),
// `true`, `false`, `null`: keywords in JetBrains schemes, which have no key of their own for them.
syn("literalKeyword", "Literal keyword", [LD], "literal", { inherit: "keyword" }),
syn("identifier", "Identifiers › Local variable", [LD], "variable"),
syn("parameter", "Identifiers › Parameter", [LD], "param"),
syn("globalVariable", "Identifiers › Global variable", [LD], "global"),
@@ -317,6 +319,9 @@ const BASE_ATTRIBUTES: readonly AttributeDef[] = [
syn("functionDeclaration", "Identifiers › Function declaration", [LD], "function"),
syn("functionCall", "Identifiers › Function call", [LD], "function-call"),
syn("predefined", "Identifiers › Predefined symbol", [LD], "builtin"),
// A standard library's types and functions (String, let), apart from its other symbols.
syn("predefinedType", "Identifiers › Predefined type", [LD], "builtin-type", { inherit: "builtin" }),
syn("predefinedFunction", "Identifiers › Predefined function", [LD], "builtin-function", { inherit: "builtin" }),
syn("className", "Classes › Class name", [LD], "type"),
syn("number", "Number", [LD], "number"),
syn("string", "String › String text", [LD], "string"),
+4 -1
Переглянути файл
@@ -2961,5 +2961,8 @@
"Cannot find the source of {0}": "Cannot find the source of {0}",
"JavaScript and TypeScript": "JavaScript and TypeScript",
"Global function": "Global function",
"Decorator": "Decorator"
"Decorator": "Decorator",
"Literal keyword": "Literal keyword",
"Predefined type": "Predefined type",
"Predefined function": "Predefined function"
}
+4 -1
Переглянути файл
@@ -9288,5 +9288,8 @@
"This CLI discovers the folder itself: off hides the skill from OpenIDEA's / menu and applies only where the CLI supports disabling.": "该 CLI 会自己发现这个文件夹:关闭只会让 OpenIDEA 的 / 菜单不再提供该技能,并且只在 CLI 支持禁用时生效。",
"Cannot find the source of {0}": "找不到 {0} 的源代码",
"JavaScript and TypeScript": "JavaScript 和 TypeScript",
"Global function": "全局函数"
"Global function": "全局函数",
"Literal keyword": "字面量关键字",
"Predefined type": "预定义类型",
"Predefined function": "预定义函数"
}