Skip to content
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

Feedback providers should export a VT escape sequence for other Terminals #21495

Open
StevenBucher98 opened this issue Apr 17, 2024 · 3 comments
Labels
Issue-Enhancement the issue is more of a feature request than a bug Needs-Triage The issue is new and needs to be triaged by a work group.

Comments

@StevenBucher98
Copy link
Collaborator

Summary of the new feature / enhancement

In order to have extra UI or visual changes when feedback providers trigger in PowerShell in other terminals, i.e VSCode terminal, we need way to indicate to the terminal in a general way to notify a feedback provider triggered. We should have a VT escape sequence to notify other terminals, or at least have some logic to determine we are in VSCode and output that sequence when feedback providers trigger.

Proposed technical implementation details (optional)

Output a VT escape sequence with every feedback provider

@StevenBucher98 StevenBucher98 added Issue-Enhancement the issue is more of a feature request than a bug Needs-Triage The issue is new and needs to be triaged by a work group. labels Apr 17, 2024
@mklement0

This comment was marked as outdated.

@rhubarb-geek-nz
Copy link

rhubarb-geek-nz commented Apr 17, 2024

$env:TERM_PROGRAM -eq 'vscode' tells you that.

More generally, $host.UI.SupportsVirtualTerminal provides this information for any given host('s current configuration).

Neither mechanism gets through SSH automatically to a remote session, whereas the TERM environment variable does get forwarded.

PS> $host.UI.SupportsVirtualTerminal
True
PS> invoke-command -HostName foo -ScriptBLock { $host.UI.SupportsVirtualTerminal }
False
PS> $env:TERM='bar'
PS> ssh foo
$ echo $TERM
bar

@mklement0
Copy link
Contributor

Good point about the commands I mentioned only working locally (not also in remoting sessions).

the TERM environment variable does get forwarded.

That is true if you use the ssh utility, but If you enter an interactive session via Enter-PSSession -HostName foo, TERM is not set.

While $host.UI.SupportsVirtualTerminal is always $false in a remote PowerShell session,
$PSStyle.OutputRendering still defaults to Host in the absence of a TERM variable, and PowerShell commands do produce colored output.

It is debatable whether this is the right default and arguably Enter-PSSession too should set TERM, but, leaving that aside, user code that produces strings for the interactive command-line editing experience could base its decision as to whether to use VT/ANSI escape sequences on $PSStyle.OutputRendering -in 'Host', 'Ansi'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Enhancement the issue is more of a feature request than a bug Needs-Triage The issue is new and needs to be triaged by a work group.
Projects
Status: Needed by 7.4 GA
Development

No branches or pull requests

3 participants