iliazeus / vscode-ansi

VS Code extension enabling ANSI color styling for text documents
https://marketplace.visualstudio.com/items?itemName=iliazeus.vscode-ansi
MIT License
57 stars 6 forks source link

File language association and icon #1

Closed jaydenseric closed 4 years ago

jaydenseric commented 4 years ago

What an awesome extension, great work! I often work on CLI tools and need to manually review CLI stdout/stderr snapshots.

I think (not 100% sure) that the correct file extension for ANSI text files is .ans:

It would be great if the extension automatically associated the right file extension to the ansi language, and if these files would have a nice icon in the file explorer. If this is not possible for the extension to do automatically, perhaps it would be good to document in the readme this config you can use manually in your VS Code settings:

{
  "files.associations": {
    "*.ans": "ansi"
  },
  "vsicons.associations.files": [
    {
      "icon": "text",
      "extensions": ["ans"],
      "format": "svg"
    }
  ]
}

The icon config assumes the vscode-icons extension is installed:

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

jaydenseric commented 4 years ago

Also, in some of the screenshots in the readme the .ansi file extension is used - maybe they should be updated to use .ans instead.

iliazeus commented 4 years ago

This seems like a good idea, thanks!

To be quite honest, I just didn't know if there was even a more-or-less standard extension for ANSI text, so .ansi was chosen fairly arbitrarily :)

iliazeus commented 4 years ago

Sadly, I would not be able to provide a custom icon for the file type. File icons are distributed as sets, "icon themes". It's not possible to "override" those sets by only providing an icon for .ans files. There is an issue that tracks this problem: https://github.com/microsoft/vscode/issues/14662.

You can make a PR into https://github.com/vscode-icons/vscode-icons or https://github.com/microsoft/vscode to add the icon into those icon sets.

jaydenseric commented 4 years ago

Are you sure there is no way to associate an existing icon? We don't want to add a brand new custom icon; the existing text icon is fine.

iliazeus commented 4 years ago

As I understand, right now the only way to associate an icon, even an existing one, to a file type is to add it to an icon theme.

However, I do want to document the vscode-icons solution that you provided.