oxc-project / oxc

⚓ A collection of JavaScript tools written in Rust.
https://oxc.rs
MIT License
11.83k stars 427 forks source link

Custom icon for config files in IDEs #6521

Open nrayburn-tech opened 3 days ago

nrayburn-tech commented 3 days ago

IntelliJ and VS Code support using custom icons for files. The oxlint config files should be registered to use a custom icon. (IntelliJ issue https://github.com/oxc-project/oxc-intellij-plugin/issues/61)

VS Code has a few different contexts that allows different icons to be used. Supports SVG and PNG.

IntelliJ has a few as well. Supports SVG, PNG is deprecated.

The same icon can be used for each one, but if there's a reason to change it based on the context then that is supported.

If somebody can provide the right SVG files to use, I can update the IDEs.

DonIsaac commented 3 days ago

I made a PR into vscode-icons adding our round SVG icon. We can also add it as a file icon theme in our own extension if we want, but I think this is a better solution.

https://github.com/vscode-icons/vscode-icons/pull/3604

nrayburn-tech commented 2 days ago

I think that assumes the user has that extension installed. I don’t think that’s part of the base VS Code installation. I don’t think having the icons there hurts anything, but I think they should be part of the Oxc extension too.

DonIsaac commented 2 days ago

In VSCode, icons are enabled/disabled as entire icon sets. If we added icons to our extension, users would have to switch to Oxc's icon theme, depriving them of all other icons. I don't think this is reasonable.

I don't currently see a way only to provide a single icon. If you know of a way, LMK and I'll get it in.

nrayburn-tech commented 2 days ago

Gotcha, that’s definitely not how I expected it to work. I’ll see if I can find some alternative, but I would agree your current approach is better given how it works.

Im fine with closing this out once that PR is merged. I should be able to take your icon files and use them for the IntelliJ plugin as well, but I’m tracking that in a separate issue.

nrayburn-tech commented 2 days ago

I found something that might work, but I'm not sure of all the implications. Maybe you know.

    "languages": [
      {
        "id": "oxc",
        "filenames": [
          "oxlintrc.json",
          "oxlint.json",
          ".oxlintrc.json",
          ".oxlint.json",
          ".oxlintrc"
        ],
        "icon": {
          "light": "icon.png",
          "dark": "icon.png"
        }
      }
    ]

https://github.com/microsoft/vscode/issues/140047 https://code.visualstudio.com/api/extension-guides/file-icon-theme#language-default-icons

nrayburn-tech commented 2 days ago

Looks like doing that doesn't recognize it as a JSON file anymore. So definitely not an option that way.

pumano commented 2 days ago

.eslintrc.json also have their own respective icon that change only icon visual.