Sublime Forum

Problem with sublime-settings for syntax definition

#1

I’m working on creating a syntax definition for a language that allows “.” in variable names (not an object oriented language). I’ve changed the syntax-settings in the User folder which does what I want. When I put it into the folder that contains the files for the syntax definition (Packages\User\Sublime-Text-MVBasic-Syntax\d3) the settings aren’t applied.

I read posts on this forum and web sites that all suggest that keeping the settings in this location is the correct place. Is there something that I’m missing? What about a workaround like a install script to set the settings in the User folder?

The settings file name is: d3-basic.sublime-settings. The scope name for the syntax is d3-basic.I tried moving the settings file to the Sublime-Text-MVBasic-Syntax dir but get the same results.

0 Likes

#2

Although generally speaking Sublime will load a sublime-settings file from anywhere within any package, when it comes to the User Package it seems to want to load them only from the top level of the package (i.e. Packages\User\something.sublime-settings).

I believe this is due to the way that the settings system works in Sublime. Loading settings loads all of the files with that name from all available packages that contain the file, and saving the settings always puts them into the root of the User folder.

Hence, Sublime seems smart enough to not load settings from the User package unless they’re in the top level, as otherwise it would be impossible to edit settings that appear in the User package without the non-root version contributing settings.

Generally how this would work would be that you would create an entirely new folder in Packages for your syntax (e.g. MVBasic); in there you would put your syntax file and the settings, and you can use whatever layout you want. A similarly named settings file (in the root) of the User folder is for your user specific customizations to the default settings.

As a side note, the name of the settings file should mirror the name of the syntax, not the name of the scope that it applies; that may or may not be an issue, although you said that it worked until you moved the settings, so I’m just mentioning that for completeness.

0 Likes

#3

Moving the plugin dir out of the User directory into the Packages dir did the trick!

Thank you! I had given up on trying to fix this, I’m really glad that you knew exactly what the problem was.

0 Likes

#4

Also note that this only considers the syntax’s file name, not its “name” key within the file.

1 Like