дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-06 18:17:15 +02:00
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).
Цей коміт міститься в:
1 джерело
08aef06844
коміт
5685e060be
2 files changed
+30
-4
No files matched your search
@@ -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();
|
||||
});
|
||||
});
|
||||
@@ -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"]],
|
||||
|
||||
Reference in new issue
Заблокувати користувача