-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable VS Code's shell integration #1958
Conversation
Per PowerShell/vscode-powershell#3901 (comment) we may also want a separate setting to enable/disable this just for the Extension Terminal. |
@Tyriar hey we got it! Though like I said, I really don't like my copy/paste method, but I'm unsure if anything else is better, we may just have to settle for it. |
src/PowerShellEditorServices/Services/PowerShell/Host/PsesInternalHost.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one optional suggestion
It seems to work, but needs more testing.
07ffe63
to
fb41949
Compare
@andschwa exciting! Looking forward to testing this. |
// https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1 | ||
// with quotes escaped, `__VSCodeOriginalPSConsoleHostReadLine` removed (as it's done | ||
// in our own ReadLine function), and `[Console]::Write` replaced with `Write-Host`. | ||
// TODO: We can probably clean some of this up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean up PRs to the source are welcome 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to touch it as little as possible for now to make sure we don't break anything.
return; | ||
} | ||
|
||
# Disable shell integration when the language mode is restricted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey guys, I know I'm late to the party but I was wondering what the risk of enabling this in Constrained Language mode would be? I run PowerShell in Constrained Language Mode in my web application and use xterm.js and would love to have proper terminal support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Certain things that we need don't work when not in this mode.
in my web application and use xterm.js and would love to have proper terminal support.
There's a bunch of code in vscode to handle shell integration, you wouldn't be able to just drop this script in an xterm.js frontend and have it work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we control the host we could move a lot of these VT sequences to C# (e.g. just do Console.Write
before invoking prompt).
But that would be more explicitly depending on the implementation detail of the script rather than copy pasting it, and as @Tyriar points out it wouldn't help the target scenario.
It seems to work, but needs more testing.
I don't particularly like copy/pasting https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1 with modifications to embed it, but not sure what else to do here.
Resolves PowerShell/vscode-powershell#3901 along with PowerShell/vscode-powershell#4271.