Skip to content
TypeScript

fix(web): language dialects use their base language's icon (#22455)

Yuruzuu94b80eaf4f2c
diff --git a/apps/web/src/pierre-icons.test.ts b/apps/web/src/pierre-icons.test.ts
index 0ffceec7013..734cac86553 100644
--- a/apps/web/src/pierre-icons.test.ts
+++ b/apps/web/src/pierre-icons.test.ts
@@ -3,6 +3,7 @@ import { assert, describe, it } from "vite-plus/test";
import {
hasSpecificPierreIconForFileName,
resolvePierreIconForEntry,
+ syntheticFileNameForLanguageId,
T3_PIERRE_ICONS,
} from "./pierre-icons";
@@ -64,4 +65,22 @@ describe("Pierre file icons", () => {
assert.include(T3_PIERRE_ICONS.spriteSheet, `id="${iconName}"`);
}
});
+
+ it.each([
+ ["luau", "lua"],
+ ["xsd", "xml"],
+ ["xsl", "xml"],
+ ["xslt", "xml"],
+ ])("gives %s files and fences the %s icon", (dialect, base) => {
+ const baseIcon = resolvePierreIconForEntry(`file.${base}`, "file")?.name;
+ assert.equal(baseIcon, `t3-file-icon-${base}`);
+ for (const path of [`src/init.${dialect}`, `src/INIT.${dialect.toUpperCase()}`]) {
+ assert.equal(resolvePierreIconForEntry(path, "file")?.name, baseIcon);
+ assert.isTrue(hasSpecificPierreIconForFileName(path));
+ }
+ assert.equal(
+ resolvePierreIconForEntry(syntheticFileNameForLanguageId(dialect), "file")?.name,
+ baseIcon,
+ );
+ });
});
diff --git a/apps/web/src/pierre-icons.ts b/apps/web/src/pierre-icons.ts
index 852ccc26e12..aa45b3025c1 100644
--- a/apps/web/src/pierre-icons.ts
+++ b/apps/web/src/pierre-icons.ts
@@ -176,6 +176,7 @@ export const T3_PIERRE_ICONS = {
kt: "t3-file-icon-kotlin",
kts: "t3-file-icon-kotlin",
lua: "t3-file-icon-lua",
+ luau: "t3-file-icon-lua",
php: "t3-file-icon-php",
ps1: "t3-file-icon-powershell",
psm1: "t3-file-icon-powershell",
@@ -184,6 +185,9 @@ export const T3_PIERRE_ICONS = {
scala: "t3-file-icon-scala",
toml: "t3-file-icon-toml",
xml: "t3-file-icon-xml",
+ xsd: "t3-file-icon-xml",
+ xsl: "t3-file-icon-xml",
+ xslt: "t3-file-icon-xml",
},
} satisfies FileTreeIcons;