Sublime Forum

Switching builds - dialog

#1

Very often, I have multiple build systems per project and “auto” does not work for me. I would rather have a command, that brings list of available build systems and I choose. (The last one would be selected as a default one).

First, is there a plugin for that ? I can’t find one, so I decided to write one.

1/ How can I get list of available build systems ?
By view.settings() I only have access to “settings” part of the preferences.
So I currently have to have another list of build systems in “settings”…

2/ Is there an argument for “build” command to run specific system/cmd ?
I tried many, like “name”, “id”, “file”, etc… none of them work, so I currently have to do:

win.run_command('set_build_system', {"file": selected_cmd}) win.run_command('build')
Which is kinda lame and has side effect of changing selected build as well…

Thanks a lot for any help,

V.

0 Likes

#2

Don’t think list of Build System is available.
You can parse Packages directory and search for .sublime-build files, but really not convenient solution.

If you want to run a specific Build System (xxx.sublime-build), it must work with something like:

win.run_command('set_build_system', {"file": "Packages/Python/Python.sublime-build"}) win.run_command('build')
If you want to run a system cmd, use directly exec command with parameters as the ones specified in a .sublime-build

0 Likes

#3

Parsing Packages/* is not sufficient, as one can have build system defined in a project settings as well.

[quote=“bizoo”]

If you want to run a specific Build System (xxx.sublime-build), it must work with something like:

win.run_command('set_build_system', {"file": "Packages/Python/Python.sublime-build"}) win.run_command('build')
If you want to run a system cmd, use directly exec command with parameters as the ones specified in a .sublime-build[/quote]

Yep, that’s exactly what I posted, but it has the side effect of changing selected build…

Anyway, here is what I did, it kinda does what I need:
github.com/vojtajina/sublime-BuildSwitcher

0 Likes

#4

Yes, you’re right.

Sorry, I though it wasn’t working at all, didn’t read your question carefully enough.

[quote=“vojtajina”]Anyway, here is what I did, it kinda does what I need:
github.com/vojtajina/sublime-BuildSwitcher[/quote]

Actually, I don’t see the need for your plugin, but it’s probably useful for some particular case that I never encountered.
Using the “selector” of Build System automatically trigger the right Build System and you can use the “variants” if you need more than one Build System for the same “selector”.
If you really need something special for a project, you can add this Build System directly in the project.

To show the Command Palette with the available Build System (including the variants), I use this keybinding:

{ "keys": "ctrl+alt+shift+b"], "command": "show_overlay", "args": {"overlay": "command_palette", "text": "Build: "} }
0 Likes