Decorate file names with type or scope


#1

Continuing the discussion from File Type Icons package:

Actually, there is one thing that I don’t like about my package. There is a lot of knowledge of file masks and such encoded in the GrammarRegistry about how to determine what type a file is from file masks to parsing the contents of the file itself. But I’ve poorly duplicated only some of that by having a bunch of rules in my CSS to determine the file type from the path or the file mask. It would be great if in all the places that file names are displayed, in addition to the data-name and data-path attributes that are placed in the HTML if a data-file-type or data-file-scope could be added. Something like this:

<span class="name icon icon-file-text" data-name="package.json" data-path="package.json" data-file-scope="source.json">
</span>

I’m looking into how to add this as a PR for the Tree View, Tabs and Fuzzy Finder packages … but I’d appreciate any ideas that people have.


#2

I had this same thought when playing with file icons earlier, while editing a .php file that the original css from @abe’s file icons gist didn’t have a data-name entry for but ofc the editor recognized and syntax highlighted. Came on to suggest it but you beat me to it :slight_smile: