Sublime Forum

.sublime-syntax files priority

#1

I have two .sublime-syntax files. And they apply to the same file extension. Which one will take precedence and how do I control that?

To be more concrete. There is File Icon plugin, which has whole bunch of .sublime-syntax files (I do not understand the reason, but that beside the point). One of such files declares “.idl” file extension and is supposed to cover VS files. But “.idl” is heavily overloaded extension. I use hand-crafted syntax file in my User plugin folder to highlight and index “.idl” files I work with.
Obviously, those syntax files are in conflict, and currently one form the File Icon plugin takes precedence. I circumvent that by editing the file. But I’m interested in more robust solution. Also, it would be nice to be able to know the rules of precedence, and plan accordingly.

The Sublime Text 4 version is used.

0 Likes

#2

ST assigns icons by scope. Hence a syntax definition associated with desired file extensions is required to display file type specific icons. The dummy syntaxes provided by File Icon are used to display the file type icon even though no proper syntax is installed.

A File Icon also uses such dummy syntaxes, but it dynamically creates them only, if no “real” syntax is present for a given scope.

Syntax definitions are assigned by full path, but as syntax specific settings target the syntax file name only, I am pretty sure it is not intented to have the same syntax in different locations in the first place.

What I mean is: In general a syntax specific settings file can be used to assign a file extension to a certain sublime-syntax file, but it’s not very clear which one wins in case of several files of the same name being present in deferent folders. Maybe package loading order is important.

0 Likes