Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent integrated terminal from opening automatically

Whenever I open a PowerShell script in VS Code, the integrated terminal opens. How can we prevent the integrated terminal from opening automatically. I have searched the settings for "terminal" and have found nothing associated with auto-start.

like image 673
Shaun Luttin Avatar asked Jun 15 '18 17:06

Shaun Luttin


People also ask

How to set up multiple terminals at once?

(I use Ubuntu 18 and macOS 10.15.) If you have a specific terminal setup (ex. multiple terminals opened to different directories, python envs, workspaces, etc.), you could check out Terminals Manager which is for " setting-up multiple terminals at once " and can be configured to auto-run on startup.

How does VS Code work with the integrated terminal?

VS Code remembers the last state of your workspace and restores it. If I have the Integrated Terminal panel opened before I closed the window, it gets reopened when I reload or reopen the workspace (I can't seem to find the setting for this though). So basically, the Integrated Terminal is already auto displayed. (I use Ubuntu 18 and macOS 10.15.)

Is there a way to pass arguments to the terminal?

Yes, you can use the "terminal.integrated.shellArgs" setting to pass arguments to the shell. For instance, the following will print Hello World when opening a new Terminal instance: Show activity on this post. The previous answer was deprecated although it will still work but with a warning.

How to auto-run terminal on startup?

You just need to add a terminals.json file in your workspace (under .vscode) with something like this, and set autorun to true. This would auto-run the Terminals: Run command on startup, and restore your terminal setup on startup.


1 Answers

VSCode will remember your last session.

So, if you close the terminal and exit VSCode, the next time you open, the terminal will not be displayed.

You can set your VSCode profile to not display (close the terminal on load).

As for User Settings:

This is not the first time this has been asked for.

https://github.com/PowerShell/vscode-powershell/issues/580

powershell.startAutomatically: When set to true (default), causes the language service to start automatically the first time a PowerShell file is opened. You could then use the "Restart PowerShell Session" command to kick off the language service on demand. •

powershell.showIntegratedConsoleOnStartup: When set to true (default), causes the integrated console window to be shown automatically when the language service starts. If false, the language service starts but the console window isn't shown until the user runs script code (or runs the Show Integrated Console command)

Update as per the OP side discussion with me

What I just tested. In your custom user settings, either set the:

"powershell.enableProfileLoading": false

or if you have that setting this way:

"powershell.enableProfileLoading": true

Add this setting: "powershell.integratedConsole.showOnStartup": false,

like image 102
postanote Avatar answered Sep 29 '22 11:09

postanote