Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving terminals (per project) #128544

Closed
MauritsWilke opened this issue Jul 13, 2021 · 13 comments
Closed

Saving terminals (per project) #128544

MauritsWilke opened this issue Jul 13, 2021 · 13 comments
Assignees
Labels
feature-request Request for new features or functionality terminal General terminal issues that don't fall under another label

Comments

@MauritsWilke
Copy link

Hi! I'd like to be able to save terminals per project or being able to open them with a shortcut.
I have a project that needs 3 running terminals that I always customise in the same way (colour, name, icon and command) and i'd like to just open those all with a shortcut or a way to at least open them from a command

@meganrogge
Copy link
Contributor

Have you thought about using tasks for this?

Another good resource is https://marketplace.visualstudio.com/items?itemName=fabiospampinato.vscode-terminals

@meganrogge meganrogge added feature-request Request for new features or functionality terminal General terminal issues that don't fall under another label labels Jul 13, 2021
@MauritsWilke
Copy link
Author

Have you thought about using tasks for this?

Another good resource is https://marketplace.visualstudio.com/items?itemName=fabiospampinato.vscode-terminals

Ill look into this! Thanks

Would be nice to have it be a standard feature ofc :)

@MauritsWilke
Copy link
Author

Have you thought about using tasks for this?

Another good resource is https://marketplace.visualstudio.com/items?itemName=fabiospampinato.vscode-terminals

Doesn't seem to be saving the terminal looks though, maybe im doing something wrong but other than the name nothing is configurable (with looks)

@ArnieGA
Copy link

ArnieGA commented Jul 21, 2021

Hi:
I gave this vscode-terminals a try but honestly, it wasn't what I was looking for. I'm actually after something like what @MauritsWilke initially proposed. I'm needing a way to tell VS Code that whenever I open/load a specific project folder in the editor, I want 3 terminals to be automatically loaded:

  • Terminal 1 will be labeled "SOLUTION", will cd/start at ./, and it'll be a regular Windows CMD Prompt terminal.
  • Terminal 2 will be labeled "API", will cd/start at ./API/, and will also be a regular Windows CMD Prompt terminal.
  • Terminal 3 will be labeled "CLIENT", will cd/start at ./client-app/, and will be a Git Bash terminal.

I really don't care much for their styling (although it would be a lot better if we're able to configure that as well) at the moment.

Thank you for your time :-)

@Tyriar
Copy link
Member

Tyriar commented Jul 21, 2021

@ArnieGA you could use tasks for this:

recording (46)

Here's the .vscode/tasks.json I used for that:

{
  "version": "2.0.0",
  "presentation": {
    "echo": false,
    "reveal": "always",
    "focus": false,
    "panel": "dedicated",
    "showReuseMessage": true
  },
  "tasks": [
    {
      "label": "Setup terminals",
      "dependsOn": [
        "SOLUTION",
        "API",
        "CLIENT"
      ],
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "runOptions": {
        "runOn": "folderOpen"
      }
    },
    {
      "label": "SOLUTION",
      "command": ["cmd"],
      "type": "shell",
      "group": "build",
      "isBackground": true,
      "problemMatcher": [],
      "options": {
        "cwd": "."
      }
    },
    {
      "label": "API",
      "command": ["cmd"],
      "type": "shell",
      "group": "build",
      "isBackground": true,
      "problemMatcher": [],
      "options": {
        "cwd": "API"
      }
    },
    {
      "label": "CLIENT",
      "command": ["bash"],
      "type": "shell",
      "group": "build",
      "isBackground": true,
      "problemMatcher": [],
      "options": {
        "cwd": "client-app"
      }
    }
  ]
}

Adding presentation.group like this would let you create split terminals:

      "presentation": {
        "group": "vscode"
      }

You can run this using ctrl+shift+b but it also has auto run enabled on folder open (see runOn)

@ArnieGA
Copy link

ArnieGA commented Jul 22, 2021

@Tyriar Thank you! It did work! However, I had to add bash's filepath to Windows' PATH in order for CLIENT to work. I still believe this functionality should be available without having to touch the tasks file. Cheers!

@Tyriar
Copy link
Member

Tyriar commented Jul 22, 2021

I added a more generic example of the above to the website: microsoft/vscode-docs@50815e7

@ArnieGA
Copy link

ArnieGA commented Jul 22, 2021

@Tyriar Thank you! It did work! However, I had to add bash's filepath to Windows' PATH in order for CLIENT to work. I still believe this functionality should be available without having to touch the tasks file. Cheers!

I added a more generic example of the above to the website: microsoft/vscode-docs@50815e7

Confirming that, by replacing the "CLIENT" configuration with the following (based on your last post):

		{
			"label": "CLIENT",
			"command": "",
			"type": "shell",
			"group": "build",
			"isBackground": true,
			"problemMatcher": [],
			"options": {
				"shell": {
					"executable": "C:\\Program Files\\Git\\bin\\sh.exe",
					"args": []
				},
				"cwd": "client-app"
			}
		}

...made it possible for me to remove Git's bin folder from Windows' PATH. Hoping this helps any other fellow dev out there. Thank you very much for your time and effort. Cheers!

@Tyriar
Copy link
Member

Tyriar commented Jul 22, 2021

Nice, yeah the shell executable part means only a single shell is launched which would speed things up

@TheColorRed
Copy link

I would also like to see the ability for the terminals to execute the last command for any long running commands such as a local server.

image

@Tyriar
Copy link
Member

Tyriar commented Sep 8, 2021

While we aren't planning on introducing this feature there are alternatives:

@Tyriar Tyriar closed this as completed Sep 8, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality terminal General terminal issues that don't fall under another label
Projects
None yet
Development

No branches or pull requests

6 participants
@TheColorRed @Tyriar @ArnieGA @meganrogge @MauritsWilke and others