fabiospampinato / vscode-terminals

An extension for setting-up multiple terminals at once, or just running some commands.
MIT License
121 stars 19 forks source link

Different terminal combinations for every workspace? #7

Closed arkdelkaos closed 6 years ago

arkdelkaos commented 6 years ago

First of all, thanks for this extension!: its the reason I decided to dump atom for good. I just love the way I open my workspace now, and 3 different terminals start instantaneously with the dev backend, frontend, etc

...but if I could have different terminal-combos for every workspace, it could be awesome :) Maybe a "workspace" attribute?

fabiospampinato commented 6 years ago

Thank you @arkdelkaos, it makes me happy to hear that somebody appreciate my work :)

What do yo mean "terminal-combos"? You can define terminals locally on a per-project/folder basis using a terminals.json file, instead of globally inside your VSC settings. Isn't this what you're looking for?

arkdelkaos commented 6 years ago

Right now I'm working in two different projects:

...if I understand correctly, your are telling me to add a .vscode/terminals.json to every folder, with the terminal for that folder, and then everything will work as I want to :) I'll try that.

I was thinking about adding a workspace': 'whatever' option to the config, so you may do the same with the global config...but if I can get it done with the individual config, I'm ok ;) Thanks!

fabiospampinato commented 6 years ago

Now that I understand your use case better I suggest you define your terminals in your *.code-workspace files, unless you also sometime open their folders individually, in that case you should put each terminals inside a terminals.json file, or inside a folder-level VSC's settings file.

arkdelkaos commented 6 years ago

oh, I didn't thought about that! :+1: Thanks! With that I'll config everything as I want to :)

arkdelkaos commented 6 years ago

Mmmm...I almost have it...

{
    "folders": [
        {
            "name": "frontend",
            "path": "./frontend"
        }
    ],
    "settings": {
        "terminals.autorun": true,
        "terminals.autokill": true,
        "terminals.terminals": [
            {
            "name": "Frontend",
            "description": "thor-frontend",
            "focus": true,
            "command": "cd [workspaceFolder] && grunt serve"
            }
        ]
    }
}

This is one of my workspaces...but now [workspaceFolder] doesn't work -> cd && grunt serve (as if [workspaceFolder] is null) Its there a way to access the path of the folder named "frontend"? ;)

fabiospampinato commented 6 years ago

@arkdelkaos The value of [workspaceFolder] depends on which file you are focussing on. For instance if you have the focus on a file stored inside ./frontend that will be replace with ./frontend's absolute path.

I think in this case you should just write the actual absolute path manually instead of relying on variable substitution.

arkdelkaos commented 6 years ago

Yup, I'm writing with some junior coworkers in mind, and wanted to make it as easy as I could. I'll bypass it with autojump ;) Thanks!