VS Code and PowerShell Terminal

Welcome Forums General PowerShell Q&A VS Code and PowerShell Terminal

This topic contains 1 reply, has 2 voices, and was last updated by

 
Participant
1 week, 4 days ago.

  • Author
    Posts
  • #113555

    Participant
    Points: 0
    Rank: Member

    I want to configure VS Code so that it opens to the PowerShell terminal with the color PSReadLine. Specifically, I want to use VS Code with PowerShell as a replacement for the native PoSh console.

    I've searched everywhere but cannot seem to find a solution.

    Every time I open VS Code, it will only open to the PowerShell Integrated Terminal which has no color PSReadLine.

    What I am trying to do is not possible in VS Code ?

    I am not interested in a lecture. I just want an answer to my question.

  • #113557

    Participant
    Points: 10
    Rank: Member

    Everything is done in 'User Settings' and 'Workspace Settings'.  The ConsoelHost is the default for VSCode. Well, until the moment you load the PS Extension, the PowerShell Integrated Console/Visual Studio Code Host becomes the default, because that's why you installed the extension, so that the editor can act like the Windows PS ISE.  Of course the editor is full color.

    PIC\VSCH – PSReadline is not there as we know, but the uservoice on PS GitHub has open asks for it, but there is no date on when it is coming, as it requires a bunch of hard work to make that happen. Which is not real rush for it, since you get all the color you want in the editor and way more.

    So, just split the screen after it starts.

    Split terms – side by side

    ———————————————
    | 1: powershell | 2: PowerShell Integrated |
    ———————————————

    Really, though, the whole point of using VSCode is to use the editor (full color, intellisense) to write and run/debug/document code.

    If you are just going to use the consolehost to bang out one-liners, then there is little reason to use / open VSC. Just pop open powershell.exe/pwsh.exe and go for it.

    Now, that I've said all that. Once the PS extension is installed, it adds this line to your settings.

    "terminal.integrated.shell.windows": "C:\\WINDOWS\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe",

    Just comment that line out...

    //"terminal.integrated.shell.windows": "C:\\WINDOWS\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe",

    … and restart VSC, then it will start as if the PS Extension was never added.

    ————————–
    1: PowerShell Integrated |
    ————————–

    Yet, again, the moment you bring up a script tab, the PIC\VSCH will open because the editor requires it and take precedence over the previous one. So then you have to split …

    ———————————————
    | 1: powershell | 2: PowerShell Integrated |
    ———————————————

    … switch between the terms or split to have them open side by side and bounce between the two as needed.

    So, whether you make the setting change above or leave as is and split the term windows (as both are loaded by default), it's the same deal.

    Personally, I rarely use the console for anything. I am always in the editor, in both ISE and VSC. If I need the consolehost. I just shell out to it as I would for any other external .exe, let my code run and let it return me back to my editor session. No bouncing around needed. But hey, that's just me. All have their own work style needs.

You must be logged in to reply to this topic.