Порівняти коміти

...
Автор SHA1 Повідомлення Дата
l0ng-ai 5685e060be fix(plugins): keep the annotation colour of a theme plugin's color scheme
A theme plugin's .icls mapped DEFAULT_METADATA onto the annotation colour
and ignored ANNOTATION_NAME_ATTRIBUTES, so a scheme that only changed
DEFAULT_METADATA repainted Java annotations, which take the annotation
key (Darcula's own when the file has none).
2026-11-26 18:20:31 +08:00
2 змінених файлів з 30 додано та 4 видалено

No files matched your search

+27
Переглянути файл
@@ -0,0 +1,27 @@
import { describe, expect, it } from "vitest";
import { convertIcls } from "../intellijTheme";
const opt = (name: string, value: string) =>
`<option name="${name}"><value><option name="FOREGROUND" value="${value}"/></value></option>`;
const scheme = (parent: string, ...options: string[]) =>
`<scheme name="t" version="142" parent_scheme="${parent}"><attributes>${options.join("")}</attributes></scheme>`;
describe("annotation colour of a theme plugin's scheme (#6108)", () => {
it("keeps Darcula's annotation colour when the file only changes DEFAULT_METADATA", () => {
const { tokens } = convertIcls(scheme("Darcula", opt("DEFAULT_METADATA", "1d8711")));
expect(tokens["--syn-annotation"]).toBe("#bbb529");
expect(tokens["--syn-decorator"]).toBe("#1d8711");
});
it("takes the file's annotation key for annotations", () => {
const { tokens } = convertIcls(
scheme("Darcula", opt("DEFAULT_METADATA", "1d8711"), opt("ANNOTATION_NAME_ATTRIBUTES", "9e880d")),
);
expect(tokens["--syn-annotation"]).toBe("#9e880d");
});
it("leaves a light parent's annotation colour to the base theme", () => {
const { tokens } = convertIcls(scheme("Default", opt("DEFAULT_METADATA", "1d8711")));
expect(tokens["--syn-annotation"]).toBeUndefined();
});
});
+3 -4
Переглянути файл
@@ -163,10 +163,9 @@ export const ICLS_ATTRIBUTES: Record<string, Array<[Part, string]>> = {
DEFAULT_PARAMETER: [["FOREGROUND", "--syn-param"]],
DEFAULT_GLOBAL_VARIABLE: [["FOREGROUND", "--syn-global"]],
DEFAULT_PREDEFINED_SYMBOL: [["FOREGROUND", "--syn-builtin"]],
DEFAULT_METADATA: [
["FOREGROUND", "--syn-annotation"],
["FOREGROUND", "--syn-decorator"],
],
// Java annotations take the scheme's (or its parent's) annotation key, not DEFAULT_METADATA.
ANNOTATION_NAME_ATTRIBUTES: [["FOREGROUND", "--syn-annotation"]],
DEFAULT_METADATA: [["FOREGROUND", "--syn-decorator"]],
DEFAULT_OPERATION_SIGN: [["FOREGROUND", "--syn-punct"]],
DEFAULT_VALID_STRING_ESCAPE: [["FOREGROUND", "--syn-escape"]],
DEFAULT_TAG: [["FOREGROUND", "--syn-tag"]],