diff --git a/src/platform/icls.test.ts b/src/platform/icls.test.ts
index 44e3cf025..31d670784 100644
--- a/src/platform/icls.test.ts
+++ b/src/platform/icls.test.ts
@@ -398,6 +398,42 @@ describe(".icls schemes", () => {
for (const [name, value] of names) expect(attrs[name]?.foreground).toBe(`#${value}`);
});
+ it("imports PyCharm's function call, class, parameter and f-string keys and exports them by those keys", () => {
+ const keys = [
+ ["PY.FUNCTION_CALL", "pyFunctionCall", "d56075"],
+ ["PY.CLASS_DEFINITION", "pyClassDefinition", "7bcbff"],
+ ["PY.PARAMETER", "pyParameter", "101010"],
+ ["PY.LOCAL_VARIABLE", "pyLocalVariable", "202020"],
+ ["PY.TYPE_PARAMETER", "pyTypeParameter", "303030"],
+ ["PY.INVALID_STRING_ESCAPE", "pyInvalidEscape", "404040"],
+ ["PY.FSTRING_FRAGMENT_BRACES", "pyFString", "e89c45"],
+ ["PY.FSTRING_FORMAT_SPEC_NUMBER", "pyFormat", "505050"],
+ ] as const;
+ const xml = `${keys
+ .map(
+ ([key, , value]) =>
+ ``,
+ )
+ .join("")}
+ `;
+ const { scheme, skipped } = parseIcls(xml);
+ expect(skipped).toBe(0);
+ for (const [, id, value] of keys) expect(scheme.attributes[id]?.foreground).toBe(`#${value}`);
+ // A WebStorm function colour still sets the shared call colour; Python calls keep PyCharm's.
+ expect(scheme.attributes.functionCall?.foreground).toBe("#6dacff");
+ const { id, customs } = importScheme({}, scheme);
+ const exported = exportIcls(id, customs);
+ for (const [key] of keys) expect(exported).toContain(`name="${key}"`);
+ expect(exported).not.toContain('name="PY.STRING.F"');
+ });
+
+ it("still reads Python attributes that earlier versions exported under OPENIDEA_ names", () => {
+ const xml =
+ '
' +
+ '
';
+ expect(parseIcls(xml).scheme.attributes.pyFunctionCall?.foreground).toBe("#d56075");
+ });
+
it("imports the Python f-string colour", () => {
const xml =
'
' +
diff --git a/src/platform/icls.ts b/src/platform/icls.ts
index 4328b5b5d..e68dc3168 100644
--- a/src/platform/icls.ts
+++ b/src/platform/icls.ts
@@ -165,7 +165,16 @@ Object.assign(ATTRIBUTE_NAMES, {
"PY.STRING.U": "pyString",
"PY.FUNC_DEFINITION": "pyFunctionDeclaration",
"PY.NESTED_FUNC_DEFINITION": "pyNestedFunction",
+ "PY.FUNCTION_CALL": "pyFunctionCall",
"PY.METHOD_CALL": "pyMethodCall",
+ "PY.CLASS_DEFINITION": "pyClassDefinition",
+ "PY.PARAMETER": "pyParameter",
+ "PY.LOCAL_VARIABLE": "pyLocalVariable",
+ "PY.TYPE_PARAMETER": "pyTypeParameter",
+ "PY.INVALID_STRING_ESCAPE": "pyInvalidEscape",
+ // PyCharm's own f-string keys come first, so exports use them; PY.STRING.F is still read.
+ "PY.FSTRING_FRAGMENT_BRACES": "pyFString",
+ "PY.FSTRING_FORMAT_SPEC_NUMBER": "pyFormat",
"PY.DOC_COMMENT": "pyDocstring",
"PY.BUILTIN_NAME": "pyBuiltin",
"PY.DECORATOR": "pyDecorator",
@@ -260,6 +269,17 @@ Object.assign(ATTRIBUTE_NAMES, {
// Preserve editor attributes without a standard exchange name on our own round trip.
for (const attr of ATTRIBUTES)
if (!Object.values(ATTRIBUTE_NAMES).includes(attr.id)) ATTRIBUTE_NAMES[`OPENIDEA_${attr.id}`] = attr.id;
+// Earlier versions exported these under OPENIDEA_ names, before their PyCharm keys were mapped.
+for (const id of [
+ "pyFunctionCall",
+ "pyClassDefinition",
+ "pyParameter",
+ "pyLocalVariable",
+ "pyTypeParameter",
+ "pyInvalidEscape",
+ "pyFormat",
+])
+ ATTRIBUTE_NAMES[`OPENIDEA_${id}`] ??= id;
// One key colours an attribute, as IntelliJ shows it in the file the user sees: an explicit value replaces
// its fallback's. TypeScript keys win over JavaScript (TS.* falls back to JS.*), then Python, then the