microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.33k stars 28.59k forks source link

"files.associations" does not override file icons defined in "fileExtensions" or "fileNames" icon theme tables #58366

Closed zvinless closed 6 years ago

zvinless commented 6 years ago

Steps to Reproduce:

  1. Open Visual Studio Code and ensure you're using the default "seti" icon theme
  2. Save a new file called "test.txt"
  3. Observe that this file has the default icon in the tab bar and explorer
  4. Make another new file called "test.cpp"
  5. Observe that this file has the C++ icon in the tab bar and explorer
  6. Go to your User Settings settings.json file and add the following:
    "files.associations": {
    "*.txt": "lua",
    "*.cpp": "lua"
    }
  7. Observe that the default icon is still used for the .txt file, but the Lua icon is used for the .cpp file

I expected that the Lua icon would be used for both files.

Does this issue occur when all extensions are disabled?: Yes

Extra info: I've tried this with a variety of file extensions. From what I've found, I can't override anything defined in the seti theme's fileExtensions or fileNames, i.e.: https://github.com/Microsoft/vscode/blob/ba98d69588cd88e3f47ea23dfb31d9145cab3cbe/extensions/theme-seti/icons/vs-seti-icon-theme.json#L1246-L1427 https://github.com/Microsoft/vscode/blob/ba98d69588cd88e3f47ea23dfb31d9145cab3cbe/extensions/theme-seti/icons/vs-seti-icon-theme.json#L1778-L1823 but that I can override entries found in the languageIds table. I feel like file associations should take precedence over extensions or filenames. Might be somewhat related to #12493.

bpasero commented 6 years ago

I can reproduce and verified that the icon classes seem to be correct:

image

This only seems to reproduce if the file ends with .txt

zvinless commented 6 years ago

@bpasero I didn't test the extensions exhaustively, but here's a few cases:

icontest
aeschli commented 6 years ago

By design, an icon association for a file extension is stronger than for a language association. (see https://code.visualstudio.com/docs/extensions/themes-snippets-colorizers#_adding-a-new-icon-theme)

aeschli commented 6 years ago

In the case of txt it doesn't make much sense to have a file association as is the default as well.. Removing the file association will fix it for txt. For all other this is as designed.