Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@
"chatParticipantPrivate",
"chatParticipantAdditions",
"chatVariableResolver",
"terminalShellEnv",
"terminalShellType"
]
}
5 changes: 5 additions & 0 deletions src/features/terminal/terminalManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,11 @@ export class TerminalManagerImpl implements TerminalManager {
}

public isActivated(terminal: Terminal, environment?: PythonEnvironment): boolean {
const envVar = terminal.shellIntegration?.env;
if (envVar) {
return !!envVar['VIRTUAL_ENV'];
}

if (!environment) {
return this.activatedTerminals.has(terminal);
}
Expand Down
18 changes: 18 additions & 0 deletions src/vscode.proposed.terminalShellEnv.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

declare module 'vscode' {
// @anthonykim1 @tyriar https://github.com/microsoft/vscode/issues/227467

export interface TerminalShellIntegration {
/**
* The environment of the shell process. This is undefined if the shell integration script
* does not send the environment.
*/
readonly env: { [key: string]: string | undefined } | undefined;
}

// TODO: Is it fine that this shares onDidChangeTerminalShellIntegration with cwd and the shellIntegration object itself?
}