Skip to content

Commit fcd2e1b

Browse files
Nikola HristovNikola Hristov
authored andcommitted
1 parent 41f0754 commit fcd2e1b

316 files changed

Lines changed: 481 additions & 539 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Target/Microsoft/VSCode/Asset/cgmanifest-IYV7LT5G.json renamed to Target/Microsoft/VSCode/Asset/cgmanifest-GOMFH5PS.json

File renamed without changes.

Target/Microsoft/VSCode/Asset/cgmanifest-UTROPLVT.json renamed to Target/Microsoft/VSCode/Asset/cgmanifest-HY3FAPMG.json

File renamed without changes.

Target/Microsoft/VSCode/Asset/cgmanifest-7RLDY4CU.json renamed to Target/Microsoft/VSCode/Asset/cgmanifest-IDFLAZJV.json

File renamed without changes.

Target/Microsoft/VSCode/Asset/cgmanifest-Q7DGWBCD.json renamed to Target/Microsoft/VSCode/Asset/cgmanifest-OIDIX5HU.json

File renamed without changes.

Target/Microsoft/VSCode/Asset/cgmanifest-NVTY7W7C.json renamed to Target/Microsoft/VSCode/Asset/cgmanifest-TLDOG6HX.json

File renamed without changes.

Target/Microsoft/VSCode/Asset/shellIntegration-A37OR57L.ps1 renamed to Target/Microsoft/VSCode/Asset/shellIntegration-AU7OXZ5J.ps1

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ $env:VSCODE_STABLE = $null
2727

2828
$__vscode_shell_env_reporting = $env:VSCODE_SHELL_ENV_REPORTING
2929
$env:VSCODE_SHELL_ENV_REPORTING = $null
30+
$Global:envVarsToReport = @()
31+
if ($__vscode_shell_env_reporting) {
32+
$Global:envVarsToReport = $__vscode_shell_env_reporting.Split(',')
33+
}
3034

3135
$osVersion = [System.Environment]::OSVersion.Version
3236
$isWindows10 = $IsWindows -and $osVersion.Major -eq 10 -and $osVersion.Minor -eq 0 -and $osVersion.Build -lt 22000
@@ -97,11 +101,15 @@ function Global:Prompt() {
97101

98102
# Send current environment variables as JSON
99103
# OSC 633 ; EnvJson ; <Environment> ; <Nonce>
100-
if ($__vscode_shell_env_reporting -eq "1") {
104+
if ($Global:envVarsToReport.Count -gt 0) {
101105
$envMap = @{}
102-
Get-ChildItem Env: | ForEach-Object { $envMap[$_.Name] = $_.Value }
103-
$envJson = $envMap | ConvertTo-Json -Compress
104-
$Result += "$([char]0x1b)]633;EnvJson;$(__VSCode-Escape-Value $envJson);$Nonce`a"
106+
foreach ($varName in $envVarsToReport) {
107+
if (Test-Path "env:$varName") {
108+
$envMap[$varName] = (Get-Item "env:$varName").Value
109+
}
110+
}
111+
$envJson = $envMap | ConvertTo-Json -Compress
112+
$Result += "$([char]0x1b)]633;EnvJson;$(__VSCode-Escape-Value $envJson);$Nonce`a"
105113
}
106114

107115
# Before running the original prompt, put $? back to what it was:

Target/Microsoft/VSCode/Asset/shellIntegration-fish-OJYUWMPJ.fish renamed to Target/Microsoft/VSCode/Asset/shellIntegration-fish-WW3QU3JY.fish

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ or exit
2323
set --global VSCODE_SHELL_INTEGRATION 1
2424
set --global __vscode_shell_env_reporting $VSCODE_SHELL_ENV_REPORTING
2525
set -e VSCODE_SHELL_ENV_REPORTING
26+
set -g envVarsToReport
27+
if test -n "$__vscode_shell_env_reporting"
28+
set envVarsToReport (string split "," "$__vscode_shell_env_reporting")
29+
end
2630

2731
# Apply any explicit path prefix (see #99878)
2832
# On fish, '$fish_user_paths' is always prepended to the PATH, for both login and non-login shells, so we need
@@ -159,15 +163,20 @@ function __vsc_update_cwd --on-event fish_prompt
159163
end
160164
end
161165

162-
if test "$__vscode_shell_env_reporting" = "1"
166+
if test -n "$__vscode_shell_env_reporting"
163167
function __vsc_update_env --on-event fish_prompt
164-
__vsc_esc EnvSingleStart 1
165-
for line in (env)
166-
set myVar (echo $line | awk -F= '{print $1}')
167-
set myVal (echo $line | awk -F= '{print $2}')
168-
__vsc_esc EnvSingleEntry $myVar (__vsc_escape_value "$myVal")
168+
if test (count $envVarsToReport) -gt 0
169+
__vsc_esc EnvSingleStart 1
170+
171+
for key in $envVarsToReport
172+
if set -q $key
173+
set -l value $$key
174+
__vsc_esc EnvSingleEntry $key (__vsc_escape_value "$value")
175+
end
176+
end
177+
178+
__vsc_esc EnvSingleEnd
169179
end
170-
__vsc_esc EnvSingleEnd
171180
end
172181
end
173182

Target/Microsoft/VSCode/Asset/shellIntegration-rc-FX3DVA2N.zsh renamed to Target/Microsoft/VSCode/Asset/shellIntegration-rc-SJEHXDRG.zsh

Lines changed: 32 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ unset VSCODE_NONCE
113113
__vscode_shell_env_reporting="$VSCODE_SHELL_ENV_REPORTING"
114114
unset VSCODE_SHELL_ENV_REPORTING
115115

116+
envVarsToReport=()
117+
IFS=',' read -rA envVarsToReport <<< "$__vscode_shell_env_reporting"
118+
116119
builtin printf "\e]633;P;ContinuationPrompt=%s\a" "$(echo "$PS2" | sed 's/\x1b/\\\\x1b/g')"
117120

118121
# Report prompt type
@@ -150,23 +153,6 @@ __update_env_cache_aa() {
150153
fi
151154
}
152155

153-
__track_missing_env_vars_aa() {
154-
if [ $__vsc_use_aa -eq 1 ]; then
155-
typeset -A currentEnvMap
156-
while IFS='=' read -r key value; do
157-
currentEnvMap["$key"]="$value"
158-
done < <(env)
159-
160-
for k in "${(@k)vsc_aa_env}"; do
161-
# if currentEnvMap does not have the key, then it is missing
162-
if ! [[ -v currentEnvMap[$k] ]]; then
163-
builtin printf '\e]633;EnvSingleDelete;%s;%s;%s\a' "${(Q)k}" "$(__vsc_escape_value "${vsc_aa_env[$k]}")" "$__vsc_nonce"
164-
builtin unset "vsc_aa_env[$k]"
165-
fi
166-
done
167-
fi
168-
}
169-
170156
__update_env_cache() {
171157
local key="$1"
172158
local value="$2"
@@ -187,69 +173,49 @@ __update_env_cache() {
187173
builtin printf '\e]633;EnvSingleEntry;%s;%s;%s\a' "$key" "$(__vsc_escape_value "$value")" "$__vsc_nonce"
188174
}
189175

190-
__track_missing_env_vars() {
191-
local currentEnvKeys=();
192-
193-
while IFS='=' read -r key value; do
194-
currentEnvKeys+=("$key");
195-
done < <(env);
196-
197-
# Compare __vsc_env_keys with user's currentEnvKeys
198-
for ((i = 1; i <= ${#__vsc_env_keys[@]}; i++)); do
199-
local found=0;
200-
for envKey in "${currentEnvKeys[@]}"; do
201-
if [[ "${__vsc_env_keys[$i]}" == "$envKey" ]]; then
202-
found=1;
203-
break;
204-
fi;
205-
done;
206-
if [ "$found" = 0 ]; then
207-
builtin printf '\e]633;EnvSingleDelete;%s;%s;%s\a' "${__vsc_env_keys[$i]}" "$(__vsc_escape_value "${__vsc_env_values[$i]}")" "$__vsc_nonce";
208-
unset "__vsc_env_keys[$i]";
209-
unset "__vsc_env_values[$i]";
210-
fi;
211-
done;
212-
213-
# Remove gaps from unset
214-
__vsc_env_keys=("${(@)__vsc_env_keys}");
215-
__vsc_env_values=("${(@)__vsc_env_values}");
216-
}
217-
218-
219176
__vsc_update_env() {
220-
if [[ "$__vscode_shell_env_reporting" == "1" ]]; then
177+
if [[ ${#envVarsToReport[@]} -gt 0 ]]; then
221178
builtin printf '\e]633;EnvSingleStart;%s;%s;\a' 0 $__vsc_nonce
222179
if [ $__vsc_use_aa -eq 1 ]; then
223180
if [[ ${#vsc_aa_env[@]} -eq 0 ]]; then
224181
# Associative array is empty, do not diff, just add
225-
while IFS='=' read -r key value; do
226-
vsc_aa_env["$key"]="$value"
227-
builtin printf '\e]633;EnvSingleEntry;%s;%s;%s\a' "$key" "$(__vsc_escape_value "$value")" "$__vsc_nonce"
228-
done < <(env)
182+
for key in "${envVarsToReport[@]}"; do
183+
if [[ -v $key ]]; then
184+
vsc_aa_env["$key"]="${(P)key}"
185+
builtin printf '\e]633;EnvSingleEntry;%s;%s;%s\a' "$key" "$(__vsc_escape_value "${(P)key}")" "$__vsc_nonce"
186+
fi
187+
done
229188
else
230189
# Diff approach for associative array
231-
while IFS='=' read -r key value; do
232-
__update_env_cache_aa "$key" "$value"
233-
done < <(env)
234-
__track_missing_env_vars_aa
235-
190+
for var in "${envVarsToReport[@]}"; do
191+
if [[ -v $var ]]; then
192+
value="${(P)var}"
193+
__update_env_cache_aa "$var" "$value"
194+
fi
195+
done
196+
# Track missing env vars not needed for now, as we are only tracking pre-defined env var from terminalEnvironment.
236197
fi
237198
else
238199
# Two arrays approach
239200
if [[ ${#__vsc_env_keys[@]} -eq 0 ]] && [[ ${#__vsc_env_values[@]} -eq 0 ]]; then
240201
# Non-associative arrays are both empty, do not diff, just add
241-
while IFS='=' read -r key value; do
242-
__vsc_env_keys+=("$key")
243-
__vsc_env_values+=("$value")
244-
builtin printf '\e]633;EnvSingleEntry;%s;%s;%s\a' "$key" "$(__vsc_escape_value "$value")" "$__vsc_nonce"
245-
done < <(env)
202+
for key in "${envVarsToReport[@]}"; do
203+
if [[ -v $key ]]; then
204+
value="${(P)key}"
205+
__vsc_env_keys+=("$key")
206+
__vsc_env_values+=("$value")
207+
builtin printf '\e]633;EnvSingleEntry;%s;%s;%s\a' "$key" "$(__vsc_escape_value "$value")" "$__vsc_nonce"
208+
fi
209+
done
246210
else
247211
# Diff approach for non-associative arrays
248-
while IFS='=' read -r key value; do
249-
__update_env_cache "$key" "$value"
250-
done < <(env)
251-
__track_missing_env_vars
252-
212+
for var in "${envVarsToReport[@]}"; do
213+
if [[ -v $var ]]; then
214+
value="${(P)var}"
215+
__update_env_cache "$var" "$value"
216+
fi
217+
done
218+
# Track missing env vars not needed for now, as we are only tracking pre-defined env var from terminalEnvironment.
253219
fi
254220
fi
255221

File renamed without changes.

Target/Microsoft/VSCode/Asset/tsconfig.tsec-JHJ3CBCN.json renamed to Target/Microsoft/VSCode/Asset/tsconfig.tsec-73SWN2DO.json

File renamed without changes.

0 commit comments

Comments
 (0)