athityakumar/colorls

Icon for .fileextension

CavalcanteLeo opened this issue · 2 comments

Is it possible to add icons to these files?

  • .editorconfig
  • .env
  • .eslintignore
  • .eslintrc
  • .gitignore
  • .npmrc
  • .prettierrc
  • *.test.ts

Screenshot 2023-03-23 at 23 12 04

I've tried this way, but didn't work:

Screenshot 2023-03-23 at 23 13 30

The section on Custom configurations is incomplete in this regard.

The file files.yaml only holds the mapping between the type of file (not necessarily the file extension) and the corresponding icon to be used. For example it is quite common to interchangeably use yml and yaml as the extension for YAML files. files.yaml only holds the mapping for yml.

So, what does the program do when the file extension is yaml?

The program first refers the file file_aliases.yaml. It lies in the same directory as files.yaml. It basically maps various file extensions to types of files. I suggest you check the file in the link provided. You should be able to understand easily what I mean.

So, before defining the icon mapping in files.yaml, you should probably update file_aliases.yaml first. This is the code that determines the file type from the extension of the file, and this line loads the corresponding icon.

avdv commented

This is a duplicate of #469 which has a PR in #577.

\edit: except for the last pattern: *.test.ts -- this is a new feature, we basically would have to implement glob matching (like ls does for colors) or suffix matching at least.