Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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
8 changes: 7 additions & 1 deletion src/features/common/activation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Terminal } from 'vscode';
import { Terminal, window } from 'vscode';
import { PythonCommandRunConfiguration, PythonEnvironment } from '../../api';
import { identifyTerminalShell } from './shellDetector';
import { traceLog } from '../../common/logging';

export function isActivatableEnvironment(environment: PythonEnvironment): boolean {
return !!environment.execInfo?.activation || !!environment.execInfo?.shellActivation;
Expand All @@ -15,6 +16,11 @@ export function getActivationCommand(
environment: PythonEnvironment,
): PythonCommandRunConfiguration[] | undefined {
const shell = identifyTerminalShell(terminal);
traceLog('getActivationCommand: Shell type from API:', shell);
window.onDidChangeTerminalState((e) => {
// traceLog('getActivationCommand: Terminal state changed:', e);
traceLog('the shell type from API inside the listener:', e.state.shell);
});

let activation: PythonCommandRunConfiguration[] | undefined;
if (environment.execInfo?.shellActivation) {
Expand Down
2 changes: 2 additions & 0 deletions src/features/common/shellDetector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Terminal } from 'vscode';
import { isWindows } from '../../managers/common/utils';
import { vscodeShell } from '../../common/vscodeEnv.apis';
import { getConfiguration } from '../../common/workspace.apis';
import { traceLog } from '../../common/logging';

/*
When identifying the shell use the following algorithm:
Expand Down Expand Up @@ -150,6 +151,7 @@ function fromShellTypeApi(terminal: Terminal): string {

export function identifyTerminalShell(terminal: Terminal): string {
let shellType = fromShellTypeApi(terminal);
traceLog('IdentifyTerminalShell: Shell type from API:', shellType);

if (shellType === 'unknown') {
shellType = identifyShellFromVSC(terminal);
Expand Down