Skip to content
Open
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
12 changes: 6 additions & 6 deletions app/utils/file-icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,12 @@ export const FILENAME_ICONS: Record<string, string> = {
'CONTRIBUTING.md': 'vscode-icons-file-type-markdown',
'contributing.md': 'vscode-icons-file-type-markdown',
'CODE_OF_CONDUCT.md': 'vscode-icons-file-type-markdown',
'LICENSE': 'vscode-icons-file-type-license',
'LICENSE.md': 'vscode-icons-file-type-license',
'LICENSE.txt': 'vscode-icons-file-type-license',
'license': 'vscode-icons-file-type-license',
'license.md': 'vscode-icons-file-type-license',
'license.txt': 'vscode-icons-file-type-license',
'LICENSE': 'vscode-icons-default-file',
'LICENSE.md': 'vscode-icons-default-file',
'LICENSE.txt': 'vscode-icons-default-file',
'license': 'vscode-icons-default-file',
'license.md': 'vscode-icons-default-file',
'license.txt': 'vscode-icons-default-file',
Comment on lines +267 to +272
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 | 🟡 Minor

Consider whether LICENSE.md / LICENSE.txt should still use their extension-based icons.

Issue #2558 specifically asks for an icon on extensionless LICENSE files. With the current change, LICENSE.md and LICENSE.txt (and lowercase variants) also lose their previous icon and now resolve to the generic default file icon, even though, without any FILENAME_ICONS entry, the extension-based fallback in getFileIcon would naturally give them the markdown and text icons respectively — which is arguably more informative than the blank default.

Two alternatives worth considering:

  1. Only override the extensionless variants and let .md / .txt fall through to their extension icons:
♻️ Proposed change
-  'LICENSE': 'vscode-icons-default-file',
-  'LICENSE.md': 'vscode-icons-default-file',
-  'LICENSE.txt': 'vscode-icons-default-file',
-  'license': 'vscode-icons-default-file',
-  'license.md': 'vscode-icons-default-file',
-  'license.txt': 'vscode-icons-default-file',
+  'LICENSE': 'vscode-icons-default-file',
+  'license': 'vscode-icons-default-file',
  1. Keep the explicit entries as-is if the intent is to deliberately strip the license-branded ribbon icon from every LICENSE variant across the board.

Note that the six explicit LICENSE entries are functionally equivalent to the default fallback for the extensionless names, so keeping them is only useful if you want to force the default for the .md/.txt variants too (overriding the extension rules). Worth confirming the intended behaviour with the issue author; the tests should then follow whichever decision is made.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'LICENSE': 'vscode-icons-default-file',
'LICENSE.md': 'vscode-icons-default-file',
'LICENSE.txt': 'vscode-icons-default-file',
'license': 'vscode-icons-default-file',
'license.md': 'vscode-icons-default-file',
'license.txt': 'vscode-icons-default-file',
'LICENSE': 'vscode-icons-default-file',
'license': 'vscode-icons-default-file',
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/utils/file-icons.ts` around lines 267 - 272, The FILENAME_ICONS mapping
currently forces all LICENSE variants to the generic icon; change it to only
override extensionless LICENSE names so extension-based fallbacks still apply:
remove the keys 'LICENSE.md', 'LICENSE.txt', 'license.md', and 'license.txt'
from the mapping in app/utils/file-icons.ts (leave 'LICENSE' and 'license' if
you want to target only extensionless files), so getFileIcon's extension-based
logic will return markdown/text icons for .md/.txt files.


// Node
'.npmrc': 'vscode-icons-file-type-npm',
Expand Down
6 changes: 6 additions & 0 deletions test/unit/app/utils/file-icons.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ describe('getFileIcon', () => {
expect(getFileIcon('eslint.config.js')).toBe('vscode-icons-file-type-eslint')
expect(getFileIcon('vitest.config.ts')).toBe('vscode-icons-file-type-vitest')
expect(getFileIcon('.env')).toBe('vscode-icons-file-type-dotenv')
expect(getFileIcon('LICENSE')).toBe('vscode-icons-default-file')
expect(getFileIcon('LICENSE.md')).toBe('vscode-icons-default-file')
expect(getFileIcon('LICENSE.txt')).toBe('vscode-icons-default-file')
expect(getFileIcon('license')).toBe('vscode-icons-default-file')
expect(getFileIcon('license.md')).toBe('vscode-icons-default-file')
expect(getFileIcon('license.txt')).toBe('vscode-icons-default-file')
})

it('returns correct icons for compound extensions', () => {
Expand Down
Loading