jisaacks / ChainOfCommand

Sublime text plugin to run a chain of commands
67 stars 4 forks source link

Doesn't work with the Golang Build package #9

Open Negossia opened 7 years ago

Negossia commented 7 years ago

Hello!

I've installed the both of ChainOfCommand and Golang build. I'd like to save and build a file by one hotkey. To build a file, I use this:

    {
        "keys": ["f5"],
        "command": "golang_build",
        "args": {
            "task": "run",
        }
    }

Now, i want to save and to build. I'm trying to use this code:

{
    "keys": ["f5"],
    "command": "chain",
    "args": {
        "commands": [
            ["save"],
            ["golang_build", {
                "args": {
                "task": "run",
                }
            }],
        ]
    }
}

But it's only saves my file without building. Can you help me with this? Thanks.

Pr05p3ro commented 7 years ago

Hello, I'm using following command to save, cancel current build (if any) and run project:

{
  "keys": ["alt+r"], 
  "command": "chain", 
  "args": {
    "commands": [
      ["save"],
      ["golang_build_cancel"],
      ["golang_build", {
        "task": "run",
        "flags": ["-v", "/path/to/main.go"]
      }] 
    ]
  }
}

It works fine. -v flag is not required but can be useful if currently you are editing some other file and don't want to switch back to main.go just to re-run your project.

And in your case proper binding should look like

{
    "keys": ["f5"],
    "command": "chain",
    "args": {
        "commands": [
            ["save"],
            ["golang_build", {
                "task": "run"
            }]
        ]
    }
}