SublimeText / AFileIcon

Sublime Text File-Specific Icons for Improved Visual Grepping

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Different icon for hpp?

dortamiguel opened this issue · comments

It will be nice if the color of the .hpp icon was different from the .cpp one

image

Seems like the plugin decides the icon by its language association and not the extension.

This is how icons are assigned by ST. It needs a dedicated scope (language). Each variant therefore needs its own syntax definition file.

Added in 3.17.0

Looks like my file icons are completely gone for hpp file. I am updated to v3.17.0. Not sure if something needs refreshed or what but gave Sublime a restart and no dice.

A File Icon names c++ headers file_type_cppheader. Do you have any 3rd-party themes installed? Some of them are known to ship own icons for certain file types. If such a theme defines another name (e.g.: file_type_hpp or something along those lines, it can cause this kind of issue.

A list of installed themes might help to determine that name to add it to A File Icons.

Note: It's enough to have such a theme installed. It doesn't need to be selected.

Otherwise A File Icons resets all caches during upgrade. So any new icon should be available immediately. If in doupt you could try to reset it manually via Main Menu > Preferences > Package Settings > A File Icon > Revert to freshly installed state

Sweet the reset manually seemed to fix it. Just realized that the .h files are included and still show up as c++ icon. That is probably a separate issue though with a theme (even though I don't see any installed themes) or another package perhaps

.h files are assigned to C++ icon by design. I don't plan to provide separate icons as .h files are historically used in many c++ projects. Thus they can't be distinguished reliably.

ST's C++ syntax is assigned to .h files by default as well.

Yea that makes sense as for distinguishing between C/C++. I was saying though that a X.h shows up with the original icon shown in: #51 (comment). It doesn't show the new H icon.

image

May be due to "Always Open with ..." being called on .h files before.

It creates a Packages/User/C++.sublime-settings with

{
	"extensions":
	[
		"h",
	]
}

Removing or commenting out "h" fixes the icon.

Forgot to come back to this and update. I didn't see any Always Open with... files nor the C++.sublime-settings file.

To check assigned syntax ...

  1. open a hpp file
  2. run following command from ST's console

The result should be

>>> view.syntax()
Syntax('Packages/zzz A File Icon zzz/aliases/C++ (Header).sublime-syntax', 'C++ (Header)', True, 'source.c++.header')

Run one was with a .hpp open and run two was with a .h

>>> view.syntax()
Syntax('Packages/zzz A File Icon zzz/aliases/C++ (Header).sublime-syntax', 'C++ (Header)', True, 'source.c++.header')
>>> view.syntax()
Syntax('Packages/C++/C++.sublime-syntax', 'C++', False, 'source.c++')

Finally found the silly file. It was symbolically linked and my find command didn't see it. I used the Preference -> Browse Packages to see it. Removing the extension fixed the issue. Thank you for your help!

It turned out C++ (Header) syntax not being applied to *.h files out of the box because shipped C++ package provides a syntax specific setting to assign the extension to C++ syntax. Such settings always override file extensions from any sublime-syntax and so the one from C++ (Header) as well.

https://github.com/sublimehq/Packages/blob/dfb5099e3ad3cf06720074450b45f6e47d00fcbc/C%2B%2B/C%2B%2B.sublime-settings#L3