Merge pull request #215485 from microsoft/tyriar/stable

Disable pwsh/bash prompt reporting when on stable
This commit is contained in:
Daniel Imms 2024-06-14 11:24:35 -07:00 committed by GitHub
commit 1c74595688
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 22 additions and 4 deletions

View file

@ -157,6 +157,7 @@ export function getShellIntegrationInjection(
}
newArgs = [...newArgs]; // Shallow clone the array to avoid setting the default array
newArgs[newArgs.length - 1] = format(newArgs[newArgs.length - 1], appRoot, '');
envMixin['VSCODE_STABLE'] = productService.quality === 'stable' ? '1' : '0';
if (options.shellIntegration.suggestEnabled) {
envMixin['VSCODE_SUGGEST'] = '1';
}
@ -174,6 +175,7 @@ export function getShellIntegrationInjection(
}
newArgs = [...newArgs]; // Shallow clone the array to avoid setting the default array
newArgs[newArgs.length - 1] = format(newArgs[newArgs.length - 1], appRoot);
envMixin['VSCODE_STABLE'] = productService.quality === 'stable' ? '1' : '0';
return { newArgs, envMixin };
}
logService.warn(`Shell integration cannot be enabled for executable "${shellLaunchConfig.executable}" and args`, shellLaunchConfig.args);
@ -195,6 +197,7 @@ export function getShellIntegrationInjection(
}
newArgs = [...newArgs]; // Shallow clone the array to avoid setting the default array
newArgs[newArgs.length - 1] = format(newArgs[newArgs.length - 1], appRoot);
envMixin['VSCODE_STABLE'] = productService.quality === 'stable' ? '1' : '0';
return { newArgs, envMixin };
}
case 'fish': {
@ -220,6 +223,7 @@ export function getShellIntegrationInjection(
}
newArgs = [...newArgs]; // Shallow clone the array to avoid setting the default array
newArgs[newArgs.length - 1] = format(newArgs[newArgs.length - 1], appRoot, '');
envMixin['VSCODE_STABLE'] = productService.quality === 'stable' ? '1' : '0';
return { newArgs, envMixin };
}
case 'zsh': {

View file

@ -186,7 +186,8 @@ suite('platform - terminalEnvironment', () => {
`${repoRoot}/out/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh`
],
envMixin: {
VSCODE_INJECTION: '1'
VSCODE_INJECTION: '1',
VSCODE_STABLE: '0'
}
});
deepStrictEqual(getShellIntegrationInjection({ executable: 'bash', args: [] }, enabledProcessOptions, defaultEnvironment, logService, productService), enabledExpectedResult);
@ -201,7 +202,8 @@ suite('platform - terminalEnvironment', () => {
],
envMixin: {
VSCODE_INJECTION: '1',
VSCODE_SHELL_LOGIN: '1'
VSCODE_SHELL_LOGIN: '1',
VSCODE_STABLE: '0'
}
});
test('when array', () => {

View file

@ -170,6 +170,10 @@ __vsc_current_command=""
__vsc_nonce="$VSCODE_NONCE"
unset VSCODE_NONCE
# Some features should only work in Insiders
__vsc_stable="$VSCODE_STABLE"
unset VSCODE_STABLE
# Report continuation prompt
builtin printf "\e]633;P;ContinuationPrompt=$(echo "$PS2" | sed 's/\x1b/\\\\x1b/g')\a"
@ -252,7 +256,10 @@ __vsc_update_prompt() {
__vsc_precmd() {
__vsc_command_complete "$__vsc_status"
__vsc_current_command=""
__vsc_report_prompt
# Report prompt is a work in progress, currently encoding is too slow
if [ "$__vsc_stable" = "0" ]; then
__vsc_report_prompt
fi
__vsc_first_prompt=1
__vsc_update_prompt
}

View file

@ -21,6 +21,9 @@ $Global:__LastHistoryId = -1
$Nonce = $env:VSCODE_NONCE
$env:VSCODE_NONCE = $null
$isStable = $env:VSCODE_STABLE
$env:VSCODE_STABLE = $null
$osVersion = [System.Environment]::OSVersion.Version
$isWindows10 = $IsWindows -and $osVersion.Major -eq 10 -and $osVersion.Minor -eq 0 -and $osVersion.Build -lt 22000
@ -95,7 +98,9 @@ function Global:Prompt() {
# Prompt
# OSC 633 ; <Property>=<Value> ST
$Result += "$([char]0x1b)]633;P;Prompt=$(__VSCode-Escape-Value $OriginalPrompt)`a"
if ($isStable -eq "1") {
$Result += "$([char]0x1b)]633;P;Prompt=$(__VSCode-Escape-Value $OriginalPrompt)`a"
}
# Write command started
$Result += "$([char]0x1b)]633;B`a"