PDQ.com mobilePDQ.com desktop
Support

Customizing Visual Studio Code for PowerShell

Selin
·

If you just want the fix, install the PowerShell preview extension and paste this in your settings.json file.

{
"powershell.integratedConsole.showOnStartup": false,
"terminal.explorerKind": "external",
"powershell.integratedConsole.focusConsoleOnExecute": false
}

If you'd like to know more, please continue

Vscode has been around for years, but its usage is amping up especially in the PowerShell development space. In its simplest form, VSCode is a text editor like any other. Unlike ISE, VSCode comes with a library of tools that enrich your development experience. People who have used PowerShell with VSCode before will tell you it doesn't work, it works poorly, it works some of the time or some variant of that same sentiment. This blog post goes over some of the common issues people encounter and how to fix them.

Intellisense only sometimes works or doesn't work at all in VSCode

This one is hard to explain and chewy to understand. When you run PowerShell in VSCode, there are two potential shells you could be running. The PowerShell Integrated Console or powershell.exe.

The PSIC hosts the service that lets you press F8 to run scripts in PowerShell, and it is also linked to PowerShell’s intellisense for VSCode.

It is a vital background service, and if you kill or bog it down, you will have issues using the features that PSIC provides. PSIC isn't the only terminal you can run. You can launch cmd.exe, bash.exe, or powershell.exe as your terminal.

To solve these issues, we need to leave PSIC alone in the background and run Powershell.exe as our main console for running commands. We can achieve this by telling VSCode to use powershell.exe, and not display the integrated console on startup.

PSIC will open up, but only when you run a PowerShell script in VSCode. Maybe someday we can use the PSIC with no issues, but for now, we can just use powershell.exe to alleviate this issue.

Terminal colors don't display properly

I can't use CTRL +  ← → to select or move between words in the terminal

Both of these issues have been corrected in an update to the PowerShell preview extension.

We're not here to tell you to use VSCode because it's better. At the end of the day, it's your workspace and you should use the tools that help you the most. If you’ve experienced other issues with VSCode and PowerShell that we didn't go over, we're all ears. The good news is if you’re an admin who needs to deploy VSCode, we have it in our Package Library ready to deploy.

Don't miss the next post!

Software Rollback

How to rollback or uninstall software patches due to an unexpected network vulnerability.