fix(editor): give Darcula-based imported schemes Darcula's colours

An exported IntelliJ scheme lists only what differs from its parent. One based on
Darcula that leaves TEXT out took Islands Dark's background (#191a1c) instead of
Darcula's #2b2b2b. Attributes such a scheme doesn't name now come from Darcula,
both in Settings > Color Scheme import and in IntelliJ theme plugin import, and
exports write an empty value for an attribute they have nothing for, so the parent
can't show through on re-import. An imported scheme's gutter keeps its editor
background unless it sets its own.
Цей коміт міститься в:
l0ng-ai committed 2026-11-20 16:25:49 +08:00
1 джерело 567b432468
коміт 32f4f63d2d
8 files changed
+240 -4

No files matched your search

+12
Переглянути файл
@@ -187,6 +187,18 @@ describe("IntelliJ theme import", () => {
});
});
it("takes what a Darcula-based scheme leaves out from Darcula", () => {
const s = convertIcls(`<scheme name="Mine" version="142" parent_scheme="Darcula"><attributes>
<option name="DEFAULT_KEYWORD"><value><option name="FOREGROUND" value="ff8800"/></value></option>
<option name="DEFAULT_STRING"><value/></option>
</attributes></scheme>`);
expect(s.tokens["--bg-editor"]).toBe("#2b2b2b");
expect(s.tokens["--syn-keyword"]).toBe("#ff8800");
// An empty entry of its own replaces Darcula's colour.
expect(s.tokens["--syn-string"]).toBeUndefined();
expect(convertIcls(`<scheme name="I" parent_scheme="Islands Dark"></scheme>`).tokens).toEqual({});
});
it("only targets tokens that exist in tokens.css", () => {
const declared = new Set([...css.matchAll(/(--[a-z0-9-]+)\s*:/g)].map((m) => m[1]!));
// Read with a fallback by the editor (no tokens.css default), still themeable.