diff --git a/src/features/terminal/shells/bash/bashStartup.ts b/src/features/terminal/shells/bash/bashStartup.ts index db9be723..bbfb198c 100644 --- a/src/features/terminal/shells/bash/bashStartup.ts +++ b/src/features/terminal/shells/bash/bashStartup.ts @@ -5,7 +5,6 @@ import which from 'which'; import { traceError, traceInfo, traceVerbose } from '../../../../common/logging'; import { ShellConstants } from '../../../common/shellConstants'; import { hasStartupCode, insertStartupCode, removeStartupCode } from '../common/editUtils'; -import { getShellIntegrationEnabledCache, isWsl, shellIntegrationForActiveTerminal } from '../common/shellUtils'; import { ShellScriptEditState, ShellSetupState, ShellStartupScriptProvider } from '../startupProvider'; import { BASH_ENV_KEY, BASH_OLD_ENV_KEY, BASH_SCRIPT_VERSION, ZSH_ENV_KEY, ZSH_OLD_ENV_KEY } from './bashConstants'; @@ -69,11 +68,6 @@ async function isStartupSetup(profile: string, key: string): Promise { - const shellIntegrationEnabled = await getShellIntegrationEnabledCache(); - if ((shellIntegrationEnabled || (await shellIntegrationForActiveTerminal(name, profile))) && !isWsl()) { - removeStartup(profile, key); - return true; - } const activationContent = getActivationContent(key); try { if (await fs.pathExists(profile)) { diff --git a/src/features/terminal/shells/fish/fishStartup.ts b/src/features/terminal/shells/fish/fishStartup.ts index 40de3e98..139e4497 100644 --- a/src/features/terminal/shells/fish/fishStartup.ts +++ b/src/features/terminal/shells/fish/fishStartup.ts @@ -6,7 +6,6 @@ import which from 'which'; import { traceError, traceInfo, traceVerbose } from '../../../../common/logging'; import { ShellConstants } from '../../../common/shellConstants'; import { hasStartupCode, insertStartupCode, removeStartupCode } from '../common/editUtils'; -import { getShellIntegrationEnabledCache, isWsl, shellIntegrationForActiveTerminal } from '../common/shellUtils'; import { ShellScriptEditState, ShellSetupState, ShellStartupScriptProvider } from '../startupProvider'; import { FISH_ENV_KEY, FISH_OLD_ENV_KEY, FISH_SCRIPT_VERSION } from './fishConstants'; @@ -58,11 +57,6 @@ async function isStartupSetup(profilePath: string, key: string): Promise { try { - const shellIntegrationEnabled = await getShellIntegrationEnabledCache(); - if ((shellIntegrationEnabled || (await shellIntegrationForActiveTerminal('fish', profilePath))) && !isWsl()) { - removeFishStartup(profilePath, key); - return true; - } const activationContent = getActivationContent(key); await fs.mkdirp(path.dirname(profilePath)); diff --git a/src/features/terminal/shells/pwsh/pwshStartup.ts b/src/features/terminal/shells/pwsh/pwshStartup.ts index 45bb33d5..7ad86f44 100644 --- a/src/features/terminal/shells/pwsh/pwshStartup.ts +++ b/src/features/terminal/shells/pwsh/pwshStartup.ts @@ -13,11 +13,8 @@ import { ShellConstants } from '../../../common/shellConstants'; import { hasStartupCode, insertStartupCode, removeStartupCode } from '../common/editUtils'; import { extractProfilePath, - getShellIntegrationEnabledCache, - isWsl, PROFILE_TAG_END, PROFILE_TAG_START, - shellIntegrationForActiveTerminal, } from '../common/shellUtils'; import { POWERSHELL_ENV_KEY, POWERSHELL_OLD_ENV_KEY, PWSH_SCRIPT_VERSION } from './pwshConstants'; @@ -169,13 +166,6 @@ async function isPowerShellStartupSetup(shell: string, profile: string): Promise } async function setupPowerShellStartup(shell: string, profile: string): Promise { - const shellIntegrationEnabled = await getShellIntegrationEnabledCache(); - - if ((shellIntegrationEnabled || (await shellIntegrationForActiveTerminal(shell, profile))) && !isWsl()) { - removePowerShellStartup(shell, profile, POWERSHELL_OLD_ENV_KEY); - removePowerShellStartup(shell, profile, POWERSHELL_ENV_KEY); - return true; - } const activationContent = getActivationContent(); try { diff --git a/src/features/terminal/terminalManager.ts b/src/features/terminal/terminalManager.ts index 394cc8db..79e31769 100644 --- a/src/features/terminal/terminalManager.ts +++ b/src/features/terminal/terminalManager.ts @@ -142,20 +142,6 @@ export class TerminalManagerImpl implements TerminalManager { this.shellSetup.clear(); } } - if (e.affectsConfiguration('terminal.integrated.shellIntegration.enabled')) { - traceInfo('Shell integration setting changed, invalidating cache'); - const updatedShellIntegrationSetting = await getShellIntegrationEnabledCache(); - if (!updatedShellIntegrationSetting) { - const shells = new Set( - terminals() - .map((t) => identifyTerminalShell(t)) - .filter((t) => t !== 'unknown'), - ); - if (shells.size > 0) { - await this.handleSetupCheck(shells); - } - } - } }), onDidChangeWindowState((e) => { this.hasFocus = e.focused; @@ -185,27 +171,22 @@ export class TerminalManagerImpl implements TerminalManager { ); if (shellIntegrationLikelyAvailable && !shouldUseProfileActivation(p.shellType)) { - // Shell integration available and NOT in WSL - skip setup - await p.teardownScripts(); + // Shell integration available and NOT in WSL - skip setup. + // NOTE: We intentionally do NOT teardown scripts here. If the user stays in + // shellStartup mode, be less aggressive about clearing profile modifications. this.shellSetup.set(p.shellType, true); traceVerbose( - `Shell integration available for ${p.shellType} (not WSL), skipping prompt, and profile modification.`, + `Shell integration likely available. Skipping setup of shell profile for ${p.shellType}.`, ); } else { - // WSL (regardless of integration) OR no shell integration - needs setup + // WSL (regardless of integration) OR no/disabled shell integration - needs setup this.shellSetup.set(p.shellType, false); shellsToSetup.push(p); traceVerbose( - `Shell integration is NOT available. Shell profile for ${p.shellType} is not setup.`, + `Shell integration is NOT available or disabled. Shell profile for ${p.shellType} is not setup.`, ); } } else if (state === ShellSetupState.Setup) { - if (shellIntegrationLikelyAvailable && !shouldUseProfileActivation(p.shellType)) { - await p.teardownScripts(); - traceVerbose( - `Shell integration available for ${p.shellType}, removed profile script in favor of shell integration.`, - ); - } this.shellSetup.set(p.shellType, true); traceVerbose(`Shell profile for ${p.shellType} is setup.`); } else if (state === ShellSetupState.NotInstalled) {