Skip to content

Commit 94b80ea

Browse files
Yuruzuuclaudemaria-rcks
authored
fix(web): language dialects use their base language's icon (pingdotgg#22455)
Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: maria-rcks <[email protected]>
1 parent b8851fb commit 94b80ea

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

‎apps/web/src/pierre-icons.test.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { assert, describe, it } from "vite-plus/test";
33
import {
44
hasSpecificPierreIconForFileName,
55
resolvePierreIconForEntry,
6+
syntheticFileNameForLanguageId,
67
T3_PIERRE_ICONS,
78
} from "./pierre-icons";
89

@@ -64,4 +65,22 @@ describe("Pierre file icons", () => {
6465
assert.include(T3_PIERRE_ICONS.spriteSheet, `id="${iconName}"`);
6566
}
6667
});
68+
69+
it.each([
70+
["luau", "lua"],
71+
["xsd", "xml"],
72+
["xsl", "xml"],
73+
["xslt", "xml"],
74+
])("gives %s files and fences the %s icon", (dialect, base) => {
75+
const baseIcon = resolvePierreIconForEntry(`file.${base}`, "file")?.name;
76+
assert.equal(baseIcon, `t3-file-icon-${base}`);
77+
for (const path of [`src/init.${dialect}`, `src/INIT.${dialect.toUpperCase()}`]) {
78+
assert.equal(resolvePierreIconForEntry(path, "file")?.name, baseIcon);
79+
assert.isTrue(hasSpecificPierreIconForFileName(path));
80+
}
81+
assert.equal(
82+
resolvePierreIconForEntry(syntheticFileNameForLanguageId(dialect), "file")?.name,
83+
baseIcon,
84+
);
85+
});
6786
});

‎apps/web/src/pierre-icons.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ export const T3_PIERRE_ICONS = {
176176
kt: "t3-file-icon-kotlin",
177177
kts: "t3-file-icon-kotlin",
178178
lua: "t3-file-icon-lua",
179+
luau: "t3-file-icon-lua",
179180
php: "t3-file-icon-php",
180181
ps1: "t3-file-icon-powershell",
181182
psm1: "t3-file-icon-powershell",
@@ -184,6 +185,9 @@ export const T3_PIERRE_ICONS = {
184185
scala: "t3-file-icon-scala",
185186
toml: "t3-file-icon-toml",
186187
xml: "t3-file-icon-xml",
188+
xsd: "t3-file-icon-xml",
189+
xsl: "t3-file-icon-xml",
190+
xslt: "t3-file-icon-xml",
187191
},
188192
} satisfies FileTreeIcons;
189193

0 commit comments

Comments
 (0)