Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I write a VSCode extension to set a file icon for a certain file extension while leaving all other extensions as the default?

Here's my icon-config.json:

{
    "iconDefinitions": {
        "file.myFileExt": {
            "iconPath": "./custom-icon.png"
        }
    },
    "fileExtensions": {
        "myExtension": "file.myFileExt"
    }
}

This works to set the file extension for foo.myExtension files, but any other file types (e.g. bar.py) have their icons removed. How can I specify a custom extension icon without overwriting all other file types to be blank?

like image 486
William Bradley Avatar asked Oct 14 '25 07:10

William Bradley


1 Answers

You can follow issue 14662.

VScode 1.64 (Jan. 2022) should include issue 140047: "finalize icon property of the language contribution point" (commit d335676)/

Language contributors can define an icon for the language.

{
 "contributes": {
   "languages": [
     {
       "id": "latex",
       // ...
       "icon": {
         "light": "./icons/latex-light.png",
         "dark": "./icons/latex-dark.png"
       }
     }
 ]

The icon is used by file icon themes as fallback if they don't have an icon for the language.

like image 196
VonC Avatar answered Oct 19 '25 14:10

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!