'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.
Solution 1:[1]
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,
Solution 2:[2]
What Worked
"powershell.integratedConsole.showOnStartup": false
If the setting isn't there yet, then simply add it.
What Almost Worked
Setting "powershell.startAutomatically": false
also kills the entire PowerShell extension.
Relying on VSCode to remember the last session's setup works inconsistently; for instance, it does not work when loading a file directly from a terminal with $ code someFile.psm1
.
Solution 3:[3]
My VSCode v1.65.2
File->Preferences->Settings
In the Search settings input field:
- Type the word-> terminal
Under Extensions:
- Click-> Remote-SSH
- Uncheck-> Always reveal the SSH login Terminal.
Close all VSCode windows and restart VSCode.
Open the remote SSH location and the integrated terminal should no longer open automatically.
Solution 4:[4]
I believe the setting is:
"terminal.integrated.enablePersistentSessions": false
regardless of Powershell or other types of terminals. This should be self-explanatory.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Raphaël Balet |
Solution 2 | |
Solution 3 | John |
Solution 4 | AsGoodAsItGets |