-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Installing Timeless can result in blank file icons in other themes.
Steps to reproduce
- Start Sublime Text in safe mode.
- Install Timeless. Do not set Timeless as the active theme.
- Open a folder with
.jsfiles. The.jsfiles will have blank sidebar icons.
Why?
Sublime Text's implementation of file icons is very fragile.
First, it looks up the syntax scope for a file extension from a mapping. This mapping is created from:
- The
file_extensionkey of.sublime-syntaxfiles - The
fileTypeskey of.tmLanguagefiles - The
extensionskey of a.sublime-settingsfile for a language.
Next, it looks up the file icon name for the mapped scope. It does so by examining all .tmPreferences file across all packages and picking the first one with an icon setting defined.
If a file with the specified name is found in the active theme, it is displayed. If not, no icon is drawn. Sublime Text does not implement any kind of fallback icon.
This is a long-standing issue first documented in 2018.
The path forward
-
In order to be a good citizen of the ecosystem, Timeless should not break other themes. The
.tmPreferencesfiles located inicons/need to be removed. This will have the side effect of disabling file icons for JavaScript, Python, etc. -
AFileIcon is the de facto package for dealing with file icons. Timeless needs to match its icon names to those in AFileIcon and add a
.supports-a-file-icon-customizationfile. -
For users that do not want to install AFileIcon, Timeless should provide a mechanism to re-enable its custom file icons. This mechanism should be manually invoked by the user (I do not believe that a theme package should run code automatically).