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
4 changes: 1 addition & 3 deletions src/features/terminal/shellStartupSetupHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ export async function handleSettingUpShellProfile(
callback: (provider: ShellStartupScriptProvider, result: boolean) => void,
): Promise<void> {
const shells = providers.map((p) => p.shellType).join(', ');
// TODO: Get opinions on potentially modifying the prompt
// - If shell integration is active, we won't need to modify user's shell profile, init scripts.
// - Current prompt we have below may not be the most accurate description.
// Only show prompt when shell integration is not available, or disabled.
const response = await showInformationMessage(
l10n.t(
'To enable "{0}" activation, your shell profile(s) may need to be updated to include the necessary startup scripts. Would you like to proceed with these changes?',
Expand Down
2 changes: 1 addition & 1 deletion src/features/terminal/shells/common/shellUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export function extractProfilePath(content: string): string | undefined {
return undefined;
}

export function shellIntegrationForActiveTerminal(name: string, profile: string): boolean {
export function shellIntegrationForActiveTerminal(name: string, profile?: string): boolean {
const hasShellIntegration = activeTerminalShellIntegration();

if (hasShellIntegration) {
Expand Down
18 changes: 15 additions & 3 deletions src/features/terminal/terminalManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { getConfiguration, onDidChangeConfiguration } from '../../common/workspa
import { isActivatableEnvironment } from '../common/activation';
import { identifyTerminalShell } from '../common/shellDetector';
import { getPythonApi } from '../pythonApi';
import { shellIntegrationForActiveTerminal } from './shells/common/shellUtils';
import { ShellEnvsProvider, ShellSetupState, ShellStartupScriptProvider } from './shells/startupProvider';
import { handleSettingUpShellProfile } from './shellStartupSetupHandlers';
import {
Expand Down Expand Up @@ -153,9 +154,20 @@ export class TerminalManagerImpl implements TerminalManager {
traceVerbose(`Checking shell profile for ${p.shellType}.`);
const state = await p.isSetup();
if (state === ShellSetupState.NotSetup) {
this.shellSetup.set(p.shellType, false);
shellsToSetup.push(p);
traceVerbose(`Shell profile for ${p.shellType} is not setup.`);
// Check if shell integration is available before marking for setup
if (shellIntegrationForActiveTerminal(p.name)) {
this.shellSetup.set(p.shellType, true);
traceVerbose(
`Shell integration available for ${p.shellType}, skipping prompt, and profile modification.`,
);
} else {
// No shell integration, mark for setup
this.shellSetup.set(p.shellType, false);
shellsToSetup.push(p);
traceVerbose(
`Shell integration is NOT avaoiable. Shell profile for ${p.shellType} is not setup.`,
);
}
} else if (state === ShellSetupState.Setup) {
this.shellSetup.set(p.shellType, true);
traceVerbose(`Shell profile for ${p.shellType} is setup.`);
Expand Down
Loading