简体   繁体   中英

How can I use the "PowerShell Integrated Console" in VS Code?

I have the PowerShell extension installed under VSCode. When I open up a PowerShell script, VS Code automatically pops open a "PowerShell Integrated Console" window in my terminal. It's different from the normal PowerShell terminal:

在此处输入图像描述

It's better than the default one because keyboard shortcuts like Ctrl+Backspace to delete a word work. But when I try to open one of these fancy terminals myself, the option isn't there:

在此处输入图像描述

How can I get one of these improved terminals without opening a script file, and how can I get VSCode to use them automatically instead of the old PS terminal?

As of version 2022.5.1 of the PowerShell extension for VSCode (Visual Studio Code), the only way to activate or launch the PIC (PowerShell Integrated Console) on demand is:

  • Use the PowerShell: Show Integrated Console command from the command palette.

  • Additionally, you may assign a keyboard shortcut to the command, by clicking the cog icon on the right edge of the command palette entry.

Because the PIC doesn't have an external executable entry point you can not define it as a custom shell profile (at least as of VSCode 1.67.1).

GitHub issue #3918 discusses implementing simpler ways to activate / load the PIC on demand as a future enhancement:

  • Making the PIC show in the list of available shells (as shown in your question, analogous to the extension-contributed JavaScript Debug Terminal entry) is one of the suggestions, but the concern is that there can only be one PIC as of this writing, so such an entry would behave differently from other shells in the list, which create a new session every time.

  • However, this concern would go away if support for multiple PICs were to be implemented, which is being proposed in GitHub issue #2418 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM