Sublime Forum

How to execute a project build system from SideBar.sublime-menu

#1

Consider this

class MyLintCommand(sublime_plugin.WindowCommand):
    def run(self, **kwargs):
        paths = kwargs.get("paths", None)
        self.window.run_command(
            "build",
            {"build_system": "just lint", "working_dir": paths[0], "variant": ""},
        )

    def is_enabled(self, paths):
        paths = [Path(v) for v in paths]
        if not paths:
            return False
        if len(paths) != 1:
            return False

        return True

When i bind it to my Side Bar.sublime-menu like:

{
    "caption": "Lint", "command": "my_lint", "args": {
        "paths": []
    },
},

the build_system won’t run in the specified working_dir and I assume that’s why the build command is targetting window.active_view().file_path as working_dir?

In that case, how is it possible run my build systems from a given working_directory? I’d like being able to leverage existing build_systems without having to create specific commands to run them from the SideBar directly

0 Likes

#2

Never mind, I decided to avoid the build command and using exec directly, thanks.

0 Likes