diff --git a/src/client/terminals/envCollectionActivation/service.ts b/src/client/terminals/envCollectionActivation/service.ts index e08a1f7e72c3..a1dcd86f0d2c 100644 --- a/src/client/terminals/envCollectionActivation/service.ts +++ b/src/client/terminals/envCollectionActivation/service.ts @@ -120,6 +120,10 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ this, this.disposables, ); + const isActive = this.isShellIntegrationActive(); + if (!isActive) { + traceWarn(`Shell integration is not active, environment activated maybe overriden by the shell.`); + } this.registeredOnce = true; } this._applyCollection(resource).ignoreErrors(); @@ -153,13 +157,14 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ shell, ); const env = activatedEnv ? normCaseKeys(activatedEnv) : undefined; + traceVerbose(`Activated environment variables for ${resource?.fsPath}`, env); if (!env) { const shellType = identifyShellFromShellPath(shell); const defaultShell = defaultShells[this.platform.osType]; if (defaultShell?.shellType !== shellType) { // Commands to fetch env vars may fail in custom shells due to unknown reasons, in that case // fallback to default shells as they are known to work better. - await this._applyCollection(resource, defaultShell?.shell); + await this._applyCollectionImpl(resource, defaultShell?.shell); return; } await this.trackTerminalPrompt(shell, resource, env); @@ -352,6 +357,9 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ // https://code.visualstudio.com/docs/terminal/shell-integration#_automatic-script-injection return true; } + if (isEnabled) { + traceVerbose('Shell integrated is disabled in user settings.'); + } return false; } diff --git a/src/client/terminals/envCollectionActivation/shellIntegration.ts b/src/client/terminals/envCollectionActivation/shellIntegration.ts index 1be2501595a4..6b9c25a681a1 100644 --- a/src/client/terminals/envCollectionActivation/shellIntegration.ts +++ b/src/client/terminals/envCollectionActivation/shellIntegration.ts @@ -5,6 +5,7 @@ import { TerminalShellType } from '../../common/terminal/types'; * https://code.visualstudio.com/docs/terminal/shell-integration */ export const ShellIntegrationShells = [ + TerminalShellType.commandPrompt, // Shell integration is not supported, but is also not needed to activate the env. TerminalShellType.powershell, TerminalShellType.powershellCore, TerminalShellType.bash,