github PowerShell/vscode-powershell v0.10.0

latest releases: v2024.2.1, v2024.2.0, v2024.3.2-preview...
pre-release7 years ago

New interactive console experience

We are excited to provide you with the first release of our new interactive
console experience! When you open up a PowerShell script file, you will
be greeted with a new VS Code integrated terminal window called
"PowerShell Integrated Console"

integrated console screenshot

In this console you will have an experience that falls somewhere between
the PowerShell ISE and the PowerShell console host:

  • Tab completion of commands and their parameters
  • Basic command history, accessed using the up/down arrow keys
  • The psedit command opens existing files in an editor pane
  • Pressing F8 in an editor pane runs the current line or selection in the console
  • Native applications like git are fully supported
  • Script debugging shares the same console session with the editor for
    a true ISE-like debugging experience

It even works with your fancy prompt function if configured in your
VS Code profile ($HOME\Documents\WindowsPowerShell\Microsoft.VSCode_profile.ps1):

custom prompt screenshot

The integrated console is supported on PowerShell v3 through v6 and works
on Linux and macOS with PowerShell Core. By default you don't have to
configure which PowerShell to run, we will pick an appropriate default
based on your platform. If you'd like to choose a different install
of PowerShell you can always change the powershell.developer.powerShellExePath
setting.

Keep in mind that this is the first release for this feature and there are
bound to be issues and missing functionality. Please feel free to file
GitHub issues for any bugs or feature requests!

Known Issues and Limitations
  • #535 PSReadline
    is currently not supported in the integrated console. We will enable this
    in a future release.
  • #534 Integrated console
    prompt is not restarted when you stop the debugging of a local runspace in another
    process. This will be addressed soon in a patch update.
  • #533 Backspace key
    does not work in the integrated console on Linux and macOS. The workaround for now
    is to use Ctrl+H instead of the Backspace key. This will be addressed
    soon in a patch update.
  • #536 Integrated console
    sometimes does not have a scrollbar at startup. The workaround is to resize the width
    of the VS Code window slightly and the scrollbar will appear. This will be addressed
    soon in a patch update.

Get-Credential and PSCredential support

Now that we have the integrated console, we have added support for the Get-Credential
cmdlet, Read-Host -AsSecureString, and any input prompt of type SecureString or PSCredential.
When you run any of these cmdlets you will be prompted inside the integrated console:

credential screenshot

Code formatting improvements

We now support VS Code's editor.formatOnType setting so that your code gets formatted
as you type! Formatting will be triggered when you press Enter or the closing curly
brace character }.

Based on your feedback, we've also added new code formatting options, all of which
are turned on by default:

  • powershell.codeFormatting.newLineAfterCloseBrace - Causes a newline to be inserted
    after a closing brace in multi-line expressions like if/else
  • powershell.codeFormatting.whitespaceBeforeOpenBrace - Causes whitespace to be
    inserted before an open brace like Foreach-Object {
  • powershell.codeFormatting.whitespaceBeforeOpenParen - Causes whitespace to be
    inserted before an open parentheses like if (
  • powershell.codeFormatting.whitespaceAroundOperator - Causes whitespace to be
    inserted around operators like = or +
  • powershell.codeFormatting.whitespaceAfterSeparator - Causes whitespace to be
    inserted around separator characters like ; and ,
  • powershell.codeFormatting.ignoreOneLineBlock - Single-line expressions, like
    small if/else statements, will not be expanded to multiple lines.

We've also made many improvements to the performance and stability of the formatter.

Debugging improvements

We've added a new configuration for debugging your Pester tests. By default it
merely runs Invoke-Pester at the workspace path, but you can also edit the
configuation to add additional arguments to be passed through.

We've also added support for column breakpoints. Now you can set a breakpoint
directly within a pipeline by placing your cursor at any column on a line and
running the Debug: Column Breakpoint command:

column breakpoint screenshot

For the latest PowerShell Core release (6.0.0-alpha.17),
we have also added the ability to step into ScriptBlocks that are executed on another
machine using Invoke-Command -Computer.

Set a breakpoint on an Invoke-Command line and then once it's hit:

Invoke-Command screenshot

Press F11 and you will step into the ScriptBlock. You can now continue to use
"step in" and trace the ScriptBlock's execution on the remote machine:

remote script listing screenshot

Note that you cannot currently set breakpoints in the script listing file as
this code is being executed without an actual script file on the remote machine.

Other fixes and improvements

  • Fixed #427 -
    The keybinding for "Expand Alias" command has been changed to Shift+Alt+E
  • Fixed #519 -
    Debugger hangs after continuing when watch expressions are set
  • Fixed #448 -
    Code formatter should keep indentation for multi-line pipelines
  • Fixed #518 -
    Code formatter fails when dollar-paren $() expressions are used
  • Fixed #447 -
    Code formatter crashes when run on untitled documents

Don't miss a new vscode-powershell release

NewReleases is sending notifications on new releases.