+2

The ability to expand sublime user setting in the .sublime-build, like the limited build variable expansion.

Mike Chilton 6 years ago • updated by Emanuele D'Osualdo 6 years ago 1
For example:-
In  makefile.sublime-build I could do the following set up
"cmd": ["make","${settings:buildtype}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${project_path:${folder:${file_path}}}",
"selector": "source.makefile", 
So as a user I could define a user setting "buildtype:"release" which I could change to "buildtype:"debug" to quickly change between build types, this would also allow me to easily create new ones, like "master", by simple editing my my build system (which is different to make) and changing the user settings, without having to create variants or edit the .sublime-build file etc.  Would be most useful for such things as multi-platform builds, as I could also define multiple user settings, for example settings for a  buildtype and buildplatform in so doing create multiple platform builds with "cmd": ["make","${settings:buildtype}_${settings:buildplatform}"]. I think this would be a simple but powerful addition to the sublime-build implementation.
This could be also used to define "master files": suppose i have a coding project spreading across many files; one of these is the Main file and when I press Build I want the Main file to be compiled, not the currently viewed one. So by defining something like

"cmd": ["compile", "${settings.main_file:${file}}"]

we would be able to compile normally when no main_file has been defined BUT we could then also provide a main_file value in the setting section of a  Project file and then get the Main compiled for that project.