Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions apps/desktop/scripts/generate-file-icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,25 @@ function run() {
addIcon(manifest.file);
addIcon(manifest.folder);
addIcon(manifest.folderExpanded);
addIcon(manifest.rootFolder);
addIcon(manifest.rootFolderExpanded);

// File mappings
for (const icon of Object.values(manifest.fileNames ?? {})) addIcon(icon);
for (const icon of Object.values(manifest.fileExtensions ?? {}))
addIcon(icon);

// Language ID mappings (VS Code languageId → icon, not covered by extensions)
for (const icon of Object.values(manifest.languageIds ?? {})) addIcon(icon);

// Folder mappings
for (const icon of Object.values(manifest.folderNames ?? {})) addIcon(icon);
for (const icon of Object.values(manifest.folderNamesExpanded ?? {}))
addIcon(icon);
for (const icon of Object.values(manifest.rootFolderNames ?? {}))
addIcon(icon);
for (const icon of Object.values(manifest.rootFolderNamesExpanded ?? {}))
addIcon(icon);

// Build condensed manifest
const condensed: CondensedManifest = {
Expand All @@ -56,13 +65,19 @@ function run() {
};

// material-icon-theme relies on VS Code's languageIds for base extensions.
// Since Electron has no languageId system, add them explicitly.
const baseExtensionDefaults: Record<string, string> = {
// Since Electron has no languageId system, fold languageIds where the
// language name matches a common file extension so they resolve at runtime.
const languageIdExtensionMap: Record<string, string> = {
ts: "typescript",
js: "javascript",
php: "php",
tex: "tex",
m: "matlab",
diff: "diff",
patch: "diff",
};
Comment on lines +70 to 78
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Bug: MATLAB extension mapping should be m, not matlab.

The PR objective states: "Verify that .m (matlab) files show correct icons." However, the current mapping matlab: "matlab" would match .matlab files, not .m files—MATLAB's actual file extension.

🐛 Proposed fix
 const languageIdExtensionMap: Record<string, string> = {
   ts: "typescript",
   js: "javascript",
   php: "php",
   tex: "tex",
-  matlab: "matlab",
+  m: "matlab",
   diff: "diff",
 };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/desktop/scripts/generate-file-icons.ts` around lines 70 - 77, The
languageIdExtensionMap entry for MATLAB is incorrect: replace the key "matlab"
with the actual file extension "m" (i.e., update languageIdExtensionMap so it
contains m: "matlab" instead of matlab: "matlab") so `.m` files map to the
MATLAB icon; locate and edit the languageIdExtensionMap constant to make this
change.


for (const [ext, icon] of Object.entries(baseExtensionDefaults)) {
for (const [ext, icon] of Object.entries(languageIdExtensionMap)) {
if (!condensed.fileExtensions[ext]) {
condensed.fileExtensions[ext] = icon;
referencedIcons.add(icon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const FILE_ICONS_DIR = "file-icons";

export function resolveFileIconAssetUrl(
iconName: string,
baseHref = globalThis.location?.origin ?? "http://localhost",
baseHref = globalThis.location?.href ?? "http://localhost/",
): string {
return new URL(`${FILE_ICONS_DIR}/${iconName}.svg`, baseHref).toString();
}
Loading