Setting to disable auto-loading of Integrated Terminal

See original GitHub issue

This new Integrated Terminal is a great feature. I foresee myself using it a lot in the future. That said, I’m wondering if it would be possible to put in a setting that disables the automatic loading of this terminal when opening PowerShell files. Of course you would also need to a way to load it on demand later.

The VSCode startup process has been getting faster and faster in months past and as such I have started using it to quickly view files instead of Notepad++. I will simply right-click and “Open in VSCode” to quickly take a peak at some script file. However, with this new integrated terminal this now complicates things.

I realize that for most people the loading of the user’s PowerShell profile probably doesn’t take but a couple seconds to load. However, as a system admin for Lync, Exchange, AD and several others, my profile connects to each of those services and imports a session. This process takes considerable time which is fine on most occasions, however when taking a quick look at a file it can be hindrance.

This is further exasperated by the fact that when the PowerShell extension opens the terminal panel, the VSCode integrated terminal which is also PowerShell will also start loading my profile. So each time I go to quickly view a file I have two separate powershell terminals starting up, each taking considerable time to load all of the imported sessions in my profile.

I could just remove the import of the sessions from the vscode specific powershell profile but if I were to do that I would likely never even use it since 99% of all my development is against these remote services and therefore I need these sessions during my development. I could also just ignore this, hit Ctrl + ` to hide the terminal and close out whenever I’m ready. However, while that most likely won’t cause an issue to close out while these sessions are in the middle of an import, it can be problematic if you are doing this repeatedly for several files in a row.

This was also an issue for me in the ISE days. Back when I used to use ISE for everything, I had actually written a PowerShell command, Open-ClipboardFile (with alias ofc), that allowed me to copy a file in Windows Explorer and then open that file in my currently open ISE editor (which ran as a different user than my login user). That way I wasn’t loading a new instance of ISE (and thus all of my remote sessions) every time I wanted to quickly look at a file.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:32
  • Comments:16 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
daviwilcommented, Mar 21, 2017

The change I made adds two new settings:

         "powershell.startAutomatically": {
            "type": "boolean",
            "default": true,
            "description": "If true, causes PowerShell extension features to start automatically when a PowerShell file is opened.  If false, the user must initiate startup using the 'PowerShell: Restart Current Session' command.  IntelliSense, code navigation, integrated console, code formatting, and other features will not be enabled until the extension has been started."
          },
         "powershell.integratedConsole.showOnStartup": {
            "type": "boolean",
            "default": true,
            "description": "If true, causes the integrated console to be shown automatically when the PowerShell extension is initialized."
          }

Are the descriptions there sufficient to indicate that you can enable language features without having the integrated console show by default? If not, do you have any recommendation on how I can make it clearer? Your desired behavior is supported with these settings, I just want to make sure users will understand that when they read the setting names and descriptions.

Regarding the new console, it does load your profile, just not the same one as powershell.exe: Microsoft.VSCode_profile.ps1. It also loads your $profile.CurrentUserAllHosts and $profile.AllUsersAllHosts profiles. If you want similar things to be loaded in both powershell.exe and the PowerShell extension’s integrated console, add it to $profile.CurrentUserAllHosts and check for a $host.Name of “ConsoleHost” or “Visual Studio Code Host”. Alternatively you could just dot-source your Microsoft.PowerShell_profile.ps1 script inside of Microsoft.VSCode_profile.ps1.

4reactions
TylerLeonhardtcommented, Mar 22, 2018

@SourabhRanka to not start the PowerShell extension automatically, simply go to your settings in vscode and search for powershell.startAutomatically. You can set that to false by clicking on the little pencil icon.

Keep in mind, you’ll loose out on all of the features: IntelliSense, code navigation, integrated console, code formatting, etc until you run: PowerShell: Restart Current Session in the Command Pallet (ctrl+shift+p)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prevent integrated terminal from opening automatically
Close all VSCode windows and restart VSCode. Open the remote SSH location and the integrated terminal should no longer open automatically. Share.
Read more >
PowerTip: Turn Off PowerShell Module Autoload - Scripting Blog
I want to disable the Windows PowerShell 3.0 module automatic loading of modules. How do I do this? Hey, Scripting Guy! Answer Set...
Read more >
Can the integrated Terminal be disabled? : r/vscode - Reddit
Open up the output/terminal/console/problems pane with Ctrl-J · Switch to the Output tab · Right click in the empty space to the right...
Read more >
Autoloading Classes - Manual - PHP
The spl_autoload_register() function registers any number of autoloaders, enabling for classes and interfaces to be automatically loaded if they are currently ...
Read more >
How can I set my default shell to start up tmux
Check the "Run a custom command instead of my sell" and write whatever command you want to execute at the startup of your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found