I’d like to make Build System selection a little more usable.
Currently, you select the active build system for the window via the menu, then Primary+B will run that build system. There is the option of Automatic selection of build systems, but probably in the majority of cases this isn’t able to do the right thing. Primary+Shift+B currently runs the current build system with the ‘run’ variant as a parameter.
What I’m thinking instead:
Primary+B will run the last used build system. If the last used build system isn’t relevant, or if there is no last used build system, then it prompts for a build system.
Prompting for a build system will involve showing the Command Palette pre-populated with all Relevant Build Systems.
Relevant Build Systems are determined in a similar way to the current ‘Automatic’ option: Any build system with a matching selector will be shown (e.g., Python.sublime.build if the current file is using the Python syntax definition), as will any build system with a matching keyfile (e.g., Make.sublime-build if there’s a Makefile in the current directory), as will any any build system that has neither a keyfile nor selector.
For example, if you’re editing a C++ file, and there’s a Makefile in the current directory, then pressing Primary+B will initially give you this list of options:
Build: Make
Build: Make Clean
Build: C++ Compile Single File
Build: C++ Compile and Run Single File
After selecting one, pressing Primary+B will rerun the same Build System without asking.
If the user has selected ‘Build: C++ Compile Single File’, and then starts editing a Python file, the next time Primary+B is pressed the dialog will popup again, as the last used build system is no longer in the relevant list.
Primary+Shift+B would be remapped to build but always show the popup, to ease the scenario of frequently swapping between two build systems.
This should help with the issue introduced in 3066, where having a Makefile in the current directory will make ‘Automatic’ always run that Makefile, even if you’d rather just use whatever build system is relevant to the current file.
Thoughts?