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
6 changes: 0 additions & 6 deletions src/features/terminal/shells/bash/bashStartup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -69,11 +68,6 @@ async function isStartupSetup(profile: string, key: string): Promise<ShellSetupS
return ShellSetupState.NotSetup;
}
async function setupStartup(profile: string, key: string, name: string): Promise<boolean> {
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)) {
Expand Down
6 changes: 0 additions & 6 deletions src/features/terminal/shells/fish/fishStartup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -58,11 +57,6 @@ async function isStartupSetup(profilePath: string, key: string): Promise<boolean

async function setupStartup(profilePath: string, key: string): Promise<boolean> {
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));

Expand Down
10 changes: 0 additions & 10 deletions src/features/terminal/shells/pwsh/pwshStartup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -169,13 +166,6 @@ async function isPowerShellStartupSetup(shell: string, profile: string): Promise
}

async function setupPowerShellStartup(shell: string, profile: string): Promise<boolean> {
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 {
Expand Down
31 changes: 6 additions & 25 deletions src/features/terminal/terminalManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down