Prefer base HTML icon for .html files

- Override `.html` language mapping to use the generic HTML icon
- Add test coverage asserting `index.html` resolves to `file_type_html.svg`
This commit is contained in:
Julius Marminge committed 2026-03-05 23:52:26 -08:00
1 parent 71e0573459
commit 0f208447ed
2 files changed
+5

No files matched your search

+2
View File
@@ -30,12 +30,14 @@ describe("getVscodeIconUrlForEntry", () => {
const tsxUrl = getVscodeIconUrlForEntry("checkbox.tsx", "file", "light");
const dockerfileUrl = getVscodeIconUrlForEntry("Dockerfile", "file", "dark");
const shellUrl = getVscodeIconUrlForEntry("entrypoint.sh", "file", "dark");
const htmlUrl = getVscodeIconUrlForEntry("index.html", "file", "dark");
const cursorRulesUrl = getVscodeIconUrlForEntry("general.mdc", "file", "dark");
const githubWorkflowUrl = getVscodeIconUrlForEntry(".github/workflows/ci.yml", "file", "light");
assert.isTrue(tsxUrl.endsWith("/file_type_reactts.svg"));
assert.isTrue(dockerfileUrl.endsWith("/file_type_docker.svg"));
assert.isTrue(shellUrl.endsWith("/file_type_shell.svg"));
assert.isTrue(htmlUrl.endsWith("/file_type_html.svg"));
assert.isTrue(cursorRulesUrl.endsWith("/file_type_markdown.svg"));
assert.isTrue(githubWorkflowUrl.endsWith("/file_type_light_yaml.svg"));
});
+3
View File
@@ -45,6 +45,9 @@ const languageIdByFileName = toLowercaseLookup(languageAssociations.fileNameToLa
const localLanguageIdByExtensionOverrides = {
// Cursor rules files (*.mdc) are commonly treated as markdown in VSCode/Cursor.
mdc: "markdown",
// Upstream languages.ts currently maps .html to django-html before html.
// Prefer the base HTML icon for standalone HTML files.
html: "html",
// Upstream languages.ts maps yml/yaml to specialized language ids that can produce
// non-generic YAML icons (for example cloudfoundry/esphome). Prefer the base YAML icon
// unless a more specific basename/extension match (e.g. azure-pipelines.yml) is found.