History

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`

Julius Marminge committed 8 months agov0.0.0-alpha.21

Commit 0f208441 parent 71e05732 files · +5 −0Browse files

Unified · Split

2 files
  1. apps/web/src/vscode-icons.test.ts +2 −0
  2. apps/web/src/vscode-icons.ts +3 −0
apps/web/src/vscode-icons.test.ts+2−0
@@ -30,12 +30,14 @@ describe("getVscodeIconUrlForEntry", () => { · 29 unmodified lines
3030 const tsxUrl = getVscodeIconUrlForEntry("checkbox.tsx", "file", "light");
3131 const dockerfileUrl = getVscodeIconUrlForEntry("Dockerfile", "file", "dark");
3232 const shellUrl = getVscodeIconUrlForEntry("entrypoint.sh", "file", "dark");
33+ const htmlUrl = getVscodeIconUrlForEntry("index.html", "file", "dark");
3334 const cursorRulesUrl = getVscodeIconUrlForEntry("general.mdc", "file", "dark");
3435 const githubWorkflowUrl = getVscodeIconUrlForEntry(".github/workflows/ci.yml", "file", "light");
3536
3637 assert.isTrue(tsxUrl.endsWith("/file_type_reactts.svg"));
3738 assert.isTrue(dockerfileUrl.endsWith("/file_type_docker.svg"));
3839 assert.isTrue(shellUrl.endsWith("/file_type_shell.svg"));
40+ assert.isTrue(htmlUrl.endsWith("/file_type_html.svg"));
3941 assert.isTrue(cursorRulesUrl.endsWith("/file_type_markdown.svg"));
4042 assert.isTrue(githubWorkflowUrl.endsWith("/file_type_light_yaml.svg"));
4143 });
apps/web/src/vscode-icons.ts+3−0
@@ -45,6 +45,9 @@ const languageIdByFileName = toLowercaseLookup(languageAssociations.fileNameToLa · 44 unmodified lines
4545 const localLanguageIdByExtensionOverrides = {
4646 // Cursor rules files (*.mdc) are commonly treated as markdown in VSCode/Cursor.
4747 mdc: "markdown",
48+ // Upstream languages.ts currently maps .html to django-html before html.
49+ // Prefer the base HTML icon for standalone HTML files.
50+ html: "html",
4851 // Upstream languages.ts maps yml/yaml to specialized language ids that can produce
4952 // non-generic YAML icons (for example cloudfoundry/esphome). Prefer the base YAML icon
5053 // unless a more specific basename/extension match (e.g. azure-pipelines.yml) is found.