This topic contains 3 replies, has 2 voices, and was last updated by
May 13, 2018 at 4:44 pm #100494ParticipantPoints: 97Rank: Member
I'm not sure this is the right forum to post this but I'm using Visual Studio Code in place of the Powershell_ISE and have a slight annoyance.
When I load a PowerShell script I get a second terminal session loaded called 'Powershell Integrated Terminal' which has no syntax highlighting.
Is there a way to stop this second PowerShell console loading please or get it to use colours?
Thanks very much
May 13, 2018 at 10:40 pm #100504ParticipantPoints: 780Rank: Major Contributor
Originally VSC defaulted to CMD.exe and you had to explicitly select PoSH.
The PoSH Add-in brought the PIC (VSCH) that you referencing and it is the default on script editing launch, but though it's called PowerShell Integrated Console in the drop down, if you use $host, you'll see it is actually the... note the version details...
$host Name : Visual Studio Code Host Version : 1.7.0
Vs the default PowerShell console, which does the console level color stuff. NOte the version details...
$host Name : ConsoleHost Version : 5.1.17134.48
This is really a way to get you as close to the Windows PoSH ISE environment. The ISE console also does not have color coding (well some things do) because you get that in the ISE script pane. So, in this case, VSC for the operation, this is no different than the ISE. You can pop open the ISE and see this for yourself. The Windows PoSH console has color coding, the ISE console does not as it is really meant as a output window of code you run from the script pane.
You change the way the VSC environment works, by modifying your user preferences. It is all detailed in the product docs on the MS docs site. Yet, remember, these are two separate environments and not designed to work the same way.
Honestly, their is a good deal of customization that can be done in VSC to get it to function as you'd like, but it requires you to dig at it and do a lot of trial and error to get where you want to be. Everyone has their ways of doing X or Y and you'll need to decide what is your playground, then configure it to do so.
User and Workspace Settings
Use the PowerShell Console from within Visual Studio Code
What is really allowing the color coding in the console is PSReadline.
Powershell Integrated Console colors wrong
So, see also
Customizes the behavior of command line editing in PSReadline.
So, again, using the default VSC PoSH console is no different that opening and using the Win PoSH console host.
If you want/ need the ISE-like experience, the PIC is what you get and if color while you are typing in the console is your thing, do that in the script pane, which of course color codes by default.
Meaning, if you are writing a script, then start a new script file, but you lose the powers shell console.
If you are not writing a script and just doing interactive command line stuff, then don't start a new script file and you'll stay in the default console, or switch between the two as needed. Again , each console instance you launch is a unique environment, much like using PowerShell tabs in the ISE.
May 13, 2018 at 11:01 pm #100506ParticipantPoints: 97Rank: Member
Yet again postanote you have been very helpful. Thankyou
May 15, 2018 at 3:45 am #100564ParticipantPoints: 780Rank: Major Contributor
No worries, also of note in VSCode, you can have multiple terminal windows open / viewable at the same time. Just use the 'Split Terminal' control in the terminal window. So, you can have the two different consoles and bounce between them as needed.
So, all default native console stuff you do in one and all the ISE script output stuff, etc., in the other.
You can also split the terminal by triggering the Ctrl+\ command or via the right click context menu.
The topic ‘VSCode - Powershell Integrated Console’ is closed to new replies.