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

Expose shell's environment - bash #237602

Merged
merged 71 commits into from
Jan 11, 2025
Merged
Changes from 1 commit
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
714bb39
start terminal shell env proposed
anthonykim1 Sep 17, 2024
3c412ff
fix typo
anthonykim1 Sep 17, 2024
f214756
progress on shellEnvDetectionCapability, mainThreadTerminalSI
anthonykim1 Sep 19, 2024
3923373
update IShellEnvDetectionCapability interface
anthonykim1 Sep 19, 2024
0465588
touch up on $shellEnvChange
anthonykim1 Sep 19, 2024
e1d611a
adjust IShellEnvDetectionCapability
anthonykim1 Sep 19, 2024
98131e7
properly listen to envChangeEvent
anthonykim1 Sep 19, 2024
e37f119
Serialize env map, expose on exthost
anthonykim1 Nov 4, 2024
a0602bc
Merge remote-tracking branch 'upstream/main' into shellEnvAPI
anthonykim1 Nov 4, 2024
94c6574
start adding to zsh script
anthonykim1 Nov 4, 2024
e4ab9e8
receive environment variable in extension host, properly escape "
anthonykim1 Nov 19, 2024
e2b4ca1
clean up
anthonykim1 Nov 19, 2024
1cf51a5
Add TODO: properly escape double quotes, figure out why JSON parse fa…
anthonykim1 Nov 21, 2024
f0b1578
Fix nonce check, ignore PS1 for now in bash
Tyriar Dec 2, 2024
1b2eb1f
Add some simple PS1 string tests to deserializeMessage
Tyriar Dec 2, 2024
0956b86
New approach of sending env entries separately
Tyriar Dec 2, 2024
bb735f8
be able to get EnvSingleVar
anthonykim1 Dec 3, 2024
a1503da
few comments
anthonykim1 Jan 4, 2025
61653d5
add function signature for start, set, end environment var
anthonykim1 Jan 5, 2025
db981ae
implement EnvStart, EnvEntry, EnvEnd for single env entry
anthonykim1 Jan 6, 2025
a25a9a9
deserialize env value for EnvEntry
anthonykim1 Jan 6, 2025
7fe7c26
Remove unncessary comments
anthonykim1 Jan 6, 2025
338514c
only leave pwsh in this PR and exclude other shells
anthonykim1 Jan 7, 2025
9b97e1b
keep exlcuding other shell env - only pwsh should remain
anthonykim1 Jan 7, 2025
fc9f3f5
Update src/vs/workbench/api/common/extHostTerminalShellIntegration.ts
anthonykim1 Jan 8, 2025
bb93fdd
Update src/vscode-dts/vscode.proposed.terminalShellEnv.d.ts
anthonykim1 Jan 8, 2025
0ca8a75
Update src/vs/workbench/contrib/terminal/common/scripts/shellIntegrat…
anthonykim1 Jan 8, 2025
935f14a
Update src/vs/workbench/contrib/terminal/common/scripts/shellIntegrat…
anthonykim1 Jan 8, 2025
2f7b969
Update src/vs/workbench/contrib/terminal/common/scripts/shellIntegrat…
anthonykim1 Jan 8, 2025
cb997d5
Update src/vs/workbench/api/common/extHostTerminalShellIntegration.ts
anthonykim1 Jan 8, 2025
b6b673f
Update src/vs/platform/terminal/common/capabilities/shellEnvDetection…
anthonykim1 Jan 8, 2025
0ab7322
Update src/vs/workbench/api/common/extHost.protocol.ts
anthonykim1 Jan 8, 2025
fe93145
Update src/vs/workbench/api/browser/mainThreadTerminalShellIntegratio…
anthonykim1 Jan 8, 2025
badfb37
Update src/vs/platform/terminal/common/capabilities/shellEnvDetection…
anthonykim1 Jan 8, 2025
3f156f9
Update src/vs/platform/terminal/common/capabilities/shellEnvDetection…
anthonykim1 Jan 8, 2025
4e8c2cb
Update src/vs/platform/terminal/common/capabilities/shellEnvDetection…
anthonykim1 Jan 8, 2025
333c8d5
Update src/vs/platform/terminal/common/capabilities/capabilities.ts
anthonykim1 Jan 8, 2025
c68c58a
Update src/vs/workbench/api/browser/mainThreadTerminalShellIntegratio…
anthonykim1 Jan 8, 2025
944ce9a
Update src/vs/platform/terminal/common/xterm/shellIntegrationAddon.ts
anthonykim1 Jan 8, 2025
b2afe32
Update src/vs/platform/terminal/common/xterm/shellIntegrationAddon.ts
anthonykim1 Jan 8, 2025
dbbe2df
Update src/vs/platform/terminal/common/xterm/shellIntegrationAddon.ts
anthonykim1 Jan 8, 2025
0b248e2
add comment for ShellEnvDetection
anthonykim1 Jan 8, 2025
d246ba7
change envs in shellEnvDetectionCapability to env
anthonykim1 Jan 8, 2025
6b081da
Mention escaping character for EnvJSON similar to commandLine
anthonykim1 Jan 8, 2025
d555813
Do not fire env event if env has not changed
anthonykim1 Jan 8, 2025
3591fa4
add link to CommandLine
anthonykim1 Jan 9, 2025
143a4cc
follow main branch format so I avoid merge conflict
anthonykim1 Jan 9, 2025
6509fa1
Merge branch 'main' into shellEnvPwshOnly
anthonykim1 Jan 9, 2025
03fe326
remove resolved TODO
anthonykim1 Jan 9, 2025
d501cee
Update src/vs/workbench/api/browser/mainThreadTerminalShellIntegratio…
anthonykim1 Jan 9, 2025
e94cf4d
Update src/vs/platform/terminal/common/xterm/shellIntegrationAddon.ts
anthonykim1 Jan 9, 2025
0b831a5
use vscode object equals
anthonykim1 Jan 9, 2025
5f9f2db
Merge branch 'main' into shellEnvPwshOnly
Tyriar Jan 9, 2025
f853a1a
add zsh update_env for shellIntegration-zsh.sh
anthonykim1 Jan 9, 2025
a438864
add EnvStart, EnvEntry, EnvEnd
anthonykim1 Jan 9, 2025
df71492
why doesnt if [ "$__vsc_stable" = "0" ]; work
anthonykim1 Jan 9, 2025
2a9d2d7
add test to check shellPath
anthonykim1 Jan 9, 2025
2aee3f0
Merge branch 'main' into shellEnvBashOnly
anthonykim1 Jan 9, 2025
fac9a74
stop messing with formatting
anthonykim1 Jan 9, 2025
e372a9d
try to be more detail in testing
anthonykim1 Jan 10, 2025
29b59e5
clean up
anthonykim1 Jan 10, 2025
e3ffe10
dont change the format
anthonykim1 Jan 10, 2025
6bc4f46
properly use stable/insider flag so update_env on insiders
anthonykim1 Jan 10, 2025
5560bdc
modify test after feedback
anthonykim1 Jan 10, 2025
9c42014
Merge branch 'main' into shellEnvBashOnly
anthonykim1 Jan 10, 2025
9032f16
rename to *EnvironmentSingleVar and make it transactional via _pendin…
anthonykim1 Jan 10, 2025
f4c32eb
add docs for *EnvSingle and update bash script to conform to *EnvSingle
anthonykim1 Jan 10, 2025
fbde338
Update src/vs/platform/terminal/common/capabilities/shellEnvDetection…
anthonykim1 Jan 10, 2025
06c4ce8
Update src/vs/platform/terminal/common/capabilities/shellEnvDetection…
anthonykim1 Jan 10, 2025
532ef41
remove _env.clear from start and make _env non-readonly
anthonykim1 Jan 10, 2025
9b6a10e
Update src/vs/platform/terminal/common/capabilities/shellEnvDetection…
Tyriar Jan 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
only leave pwsh in this PR and exclude other shells
  • Loading branch information
anthonykim1 committed Jan 7, 2025
commit 338514ca5d45d7e5703ee064a5aef1a73655482a
3 changes: 0 additions & 3 deletions src/vs/platform/terminal/common/capabilities/capabilities.ts
Original file line number Diff line number Diff line change
@@ -153,9 +153,6 @@ export interface IShellEnvDetectionCapability {
readonly onDidChangeEnv: Event<Map<string, string>>;
get envs(): Map<string, string>;
setEnvironment(envs: { [key: string]: string | undefined } | undefined, isTrusted: boolean): void;
startSingleEnvironmentVar(isTrusted: boolean): void;
setSingleEnvironmentVar(key: string, value: string | undefined, isTrusted: boolean): void;
endSingleEnvironmentVar(isTrusted: boolean): void;
applyEnvironmentDiff(envs: { [key: string]: string | undefined } | undefined): void;
}

Original file line number Diff line number Diff line change
@@ -34,27 +34,6 @@ export class ShellEnvDetectionCapability extends Disposable implements IShellEnv
// Convert to event and fire event
this._onDidChangeEnv.fire(this._env);
}
// Clear out the current WIP env
startSingleEnvironmentVar(isTrusted: boolean): void {
if (!isTrusted) {
return;
}
this._env.clear();
}
setSingleEnvironmentVar(key: string, value: string | undefined, isTrusted: boolean): void {
if (!isTrusted) {
return;
}
if (key !== undefined && value !== undefined) { // Is this enough of a check
this._env.set(key, value);
}
}
endSingleEnvironmentVar(isTrusted: boolean): void {
if (!isTrusted) {
return;
}
this._onDidChangeEnv.fire(this._env);
}

applyEnvironmentDiff(env: { [key: string]: string | undefined }): void {
// TODO: Implement
25 changes: 0 additions & 25 deletions src/vs/platform/terminal/common/xterm/shellIntegrationAddon.ts
Original file line number Diff line number Diff line change
@@ -240,12 +240,6 @@ const enum VSCodeOscPt {
*/
Env = 'Env',

EnvStart = 'EnvStart',

EnvEntry = 'EnvEntry',

EnvEnd = 'EnvEnd'

}

/**
@@ -457,25 +451,6 @@ export class ShellIntegrationAddon extends Disposable implements IShellIntegrati
}
return true;
}
// TODO: Impl
case VSCodeOscPt.EnvStart: {
this._createOrGetShellEnvDetection().startSingleEnvironmentVar(args[0] === this._nonce);
return true;
}
case VSCodeOscPt.EnvEntry: {
const arg0 = args[0]; // Key
const arg1 = args[1]; // Value
const arg2 = args[2]; // Nonce
if (arg0 !== undefined && arg1 !== undefined) {
const env = deserializeMessage(arg1);
this._createOrGetShellEnvDetection().setSingleEnvironmentVar(arg0, env, arg2 === this._nonce);
}
return true;
}
case VSCodeOscPt.EnvEnd: {
this._createOrGetShellEnvDetection().endSingleEnvironmentVar(args[0] === this._nonce);
return true;
}
case VSCodeOscPt.RightPromptStart: {
this._createOrGetCommandDetection(this._terminal).handleRightPromptStart();
return true;