Skip to content

Commit b46e1a6

Browse files
author
Kartik Raj
authored
Log whether shell integration is active (#22346)
For #20950
1 parent bcb1025 commit b46e1a6

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/client/terminals/envCollectionActivation/service.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
120120
this,
121121
this.disposables,
122122
);
123+
const isActive = this.isShellIntegrationActive();
124+
if (!isActive) {
125+
traceWarn(`Shell integration is not active, environment activated maybe overriden by the shell.`);
126+
}
123127
this.registeredOnce = true;
124128
}
125129
this._applyCollection(resource).ignoreErrors();
@@ -153,13 +157,14 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
153157
shell,
154158
);
155159
const env = activatedEnv ? normCaseKeys(activatedEnv) : undefined;
160+
traceVerbose(`Activated environment variables for ${resource?.fsPath}`, env);
156161
if (!env) {
157162
const shellType = identifyShellFromShellPath(shell);
158163
const defaultShell = defaultShells[this.platform.osType];
159164
if (defaultShell?.shellType !== shellType) {
160165
// Commands to fetch env vars may fail in custom shells due to unknown reasons, in that case
161166
// fallback to default shells as they are known to work better.
162-
await this._applyCollection(resource, defaultShell?.shell);
167+
await this._applyCollectionImpl(resource, defaultShell?.shell);
163168
return;
164169
}
165170
await this.trackTerminalPrompt(shell, resource, env);
@@ -352,6 +357,9 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
352357
// https://code.visualstudio.com/docs/terminal/shell-integration#_automatic-script-injection
353358
return true;
354359
}
360+
if (isEnabled) {
361+
traceVerbose('Shell integrated is disabled in user settings.');
362+
}
355363
return false;
356364
}
357365

src/client/terminals/envCollectionActivation/shellIntegration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { TerminalShellType } from '../../common/terminal/types';
55
* https://code.visualstudio.com/docs/terminal/shell-integration
66
*/
77
export const ShellIntegrationShells = [
8+
TerminalShellType.commandPrompt, // Shell integration is not supported, but is also not needed to activate the env.
89
TerminalShellType.powershell,
910
TerminalShellType.powershellCore,
1011
TerminalShellType.bash,

0 commit comments

Comments
 (0)