Since you don’t have a solution because of bugs or other issues - here’s something viable but will need a little bit of work to finish - a few lines plus definitions.
Create a new plugin - I use _Acecool for simple development based tests, etc… and _AcecoolHotfix or similar when writing plugins to correct bugs introduced by other plugins, or sublime text, or to change generalized behavior while remaining backwards compatible, etc…
Creating a plugin to handle this for you is actually pretty easy… When a file is clicked, on activated or on activated async ( although I wouldn’t use that unless setting the var / setting for the build system does a lot in the background as it’s quick and easy ) update the build system based on rules - if applicable… if not then don’t touch it…
Create a new Event Listener - you want on_activated - it is called when a view is clicked…
If you look at the main menu you can see some of the basic commands which are run, but not all - but all you need to do is _view.window( ).run_command( ‘…’, args ) inside of on_activated…
The base plugin file would be:
##
## My Auto Build Selection Based on File Paths
##
##
## Imports
##
## We need this because of some of the splits...
import os
## We need this because of isinstance sublime.View...
import sublime
## We need this because of sublime_plugin.EventListener - we could do import sublime, sublime_plugin if we wanted to...
import sublime_plugin
##
## Event Listener - This monitors for callbacks - in our case, on_activated is triggered when a tab is clicked so we need to potentially update the build setting by running a command - we'll need to set up some rules somewhere too... we can do it here... a simple __rules__ = { } with path components ( and we can extend it to look for file extensions, or other data )
##
class MyAutoBuildSelectorPluginEventListener( sublime_plugin.EventListener ):
##
## We need to set up some rules... basically components of a path...
##
__rules__ = {
## If AcecoolCodeMappingSystem is found in the file path, ie _text.find( ... ) > 0 then we can grab the result and perform the change... using a Dict as the = because we can store more data as to what to do...
## The downside to using this method is it can become costly the more rules we have..
## "AcecoolCodeMappingSystem": { },
## We can define a FULL path which would be O( 1 ) to check using _rule = self.__rules__.get( _path, None )... if ( _rule != None ): Perform Actions stored in _rule - this is much quicker but it also requires the full path to be used for EVERY path available for the same exact build data...
## "C:/Path/To/Files": { },
##
## Instead of putting all of them in one glob, we can add nested tables so self.__rules__.partial_paths, partial_paths_startswith, file_extensions, full_paths, then process them that way so we always know...
##
}
##
## Called when a view has taken focus by any means - We aren't using async because this is a quick and easy system - and on async can have multiples running so we'd need to set up a thread locker ( if var == True return False ... otherwise set var to True .. perform actions .. set var to False... end )
##
def on_activated( self, _view ):
## If the view is invalid by not containing a valid file name or window then don't continue..
if ( _view == None or not isinstance( _view, sublime.View ) or _view.file_name( ) == None or not isinstance( _view.window( ), sublime.Window ) ):
return False
## Helpers...
## The full path... with the filename and extension
_full_file_name = _view.file_name( )
## The filename with extension
_file_name_only = _view.file_name( ).split( '\\' )[ - 1 ]
## The file name without the extension, and the extension by itself
_base_file_name, _file_ext = os.path.splitext( os.path.basename( _syntax_path ) )
## The file path only
_file_path_only = _full_file_name[ : len( _full_file_name ) - len( _file_name_only ) ]
## Grab the views window so we can run commands..
_window = _view.window( )
## Now - look at rules to see if part the path is the entire ( _text == ), starting ( _text.startswith ), ending ( _text.endswith ), or middle ( _text.find ) of the string
## Then, the value can be a Dict, as suggested above so you can do multiple things... OR the result can be a basic string which can be used to call to command to update the build system when a file is selected..
## These are the commands used in the menu... so all you need to do is use _window.run_command( 'set_build_system', { "file": "" } ) for automatic...
## { "command": "set_build_system", "args": { "file": "" }, "caption": "Automatic", "checkbox": true },
## { "caption": "-" },
## { "command": "set_build_system", "args": {"index": 0}, "checkbox": true },
## { "command": "set_build_system", "args": {"index": 1}, "checkbox": true },
## { "command": "set_build_system", "args": {"index": 2}, "checkbox": true },
## { "command": "set_build_system", "args": {"index": 3}, "checkbox": true },
## { "command": "set_build_system", "args": {"index": 4}, "checkbox": true },
## { "command": "set_build_system", "args": {"index": 5}, "checkbox": true },
## { "command": "set_build_system", "args": {"index": 6}, "checkbox": true },
## { "command": "set_build_system", "args": {"index": 7}, "checkbox": true },
## { "command": "set_build_system", "args": {"index": 8}, "checkbox": true },
## { "command": "set_build_system", "args": {"index": 9}, "checkbox": true },
## { "command": "set_build_system", "args": {"index": 10}, "checkbox": true },
## { "command": "set_build_system", "args": {"index": 11}, "checkbox": true },
## { "caption": "-" },
## { "command": "$build_systems" },
## { "caption": "-" },
## { "command": "new_build_system", "caption": "New Build System…" }
And, your best bet to let the devs know of a potential bug / issue is to post here: https://github.com/SublimeTextIssues/Core/issues