vscode-powershell icon indicating copy to clipboard operation
vscode-powershell copied to clipboard

Support New VS Code Shell Integration Feature

Open juvtib opened this issue 2 years ago • 7 comments

Prerequisites

  • [X] I have written a descriptive issue title.
  • [X] I have searched all issues to ensure it has not already been reported.

Summary

VS Code introduced the shell integration feature in January. When the PowerShell extension launches its Integrated Console, the shell integration is not launched with it. It is not obvious if or how to manually launch the new feature.

Please respect the terminal.integrated.shellIntegration.enabled setting. And allow the new VS Code feature to work with the terminal launched by the PowerShell extension.

Proposed Design

No response

juvtib avatar Mar 31 '22 21:03 juvtib

It's still an experimental feature: https://code.visualstudio.com/docs/editor/integrated-terminal#_shell-integration

So it's unlikely to be the default, however we could look into adding a feature flag for it. The PSIC is not a normal integrated terminal so I'm not sure if there will be related regressions or something to tell vscode to flag the PSIC as an "integrated" terminal.

JustinGrote avatar Mar 31 '22 21:03 JustinGrote

I was going through my PowerShell logs and found shellIntegration.ps1 dot sourced. This must be from when VS Code starts.

Note I use PowerShell and VS Code as snaps on Linux.

. "/var/lib/snapd/snap/code/92/usr/share/code/resources/app/out/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1"


If I manually run

. "/var/lib/snapd/snap/code/current/usr/share/code/resources/app/out/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1"

in the PowerShell extension's integrated console, it appears to work:

juvtib avatar Apr 01 '22 12:04 juvtib

I noticed in the documentation they said they shim in a .ps1, so that wouldn't be that hard to just add a setting to call it if that's all it is, not sure if there's more to it though.

JustinGrote avatar Apr 01 '22 14:04 JustinGrote

Are extensions able to read the preferences for VS Code? Or is there some benefit to creating a new preference besides terminal.integrated.shellIntegration.enabled?

juvtib avatar Apr 01 '22 15:04 juvtib

There are cases where you might want it for your integrated terminal but not PSIC, but yes, extensions can read settings and it would probably be gated behind both these settings, e.g.

powershell.enableShellIntegration and terminal.integrated.shellIntegration.enabled would both have to be specified in order for it to inject the .ps1 (or whatever else is required for shell integration)

JustinGrote avatar Apr 01 '22 16:04 JustinGrote

It's still an experimental feature: https://code.visualstudio.com/docs/editor/integrated-terminal#_shell-integration

So it's unlikely to be the default, however we could look into adding a feature flag for it. The PSIC is not a normal integrated terminal so I'm not sure if there will be related regressions or something to tell vscode to flag the PSIC as an "integrated" terminal.

Shell integration is now enabled by default

danielniccoli avatar Aug 11 '22 21:08 danielniccoli

We are working on this actively!

andyleejordan avatar Aug 11 '22 22:08 andyleejordan

Thanks for addressing this issue. I'm not sure how PowerShell Editor Services is integrated into the PowerShell extension and VS Code. How will I know when this feature makes it to VS Code or the Insiders edition?

juvtib avatar Nov 21 '22 21:11 juvtib

@juvtib PSES is basically the LSP for the plugin. If this has been committed to PSES I would expect to see it in the next preview release of the PowerShell extension which comes out pretty regularly.

JustinGrote avatar Nov 21 '22 21:11 JustinGrote

Like today is the plan lol

andyleejordan avatar Nov 21 '22 21:11 andyleejordan