Skip to content

Commit

Permalink
Merge pull request microsoft#208036 from microsoft/tyriar/199611
Browse files Browse the repository at this point in the history
Enable shell integration in hidden terminals
  • Loading branch information
Tyriar authored Mar 18, 2024
2 parents cf9f245 + f5f392c commit b3701a9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/vs/platform/terminal/common/terminalEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ export function sanitizeCwd(cwd: string): string {
* @param slc The shell launch config to check.
*/
export function shouldUseEnvironmentVariableCollection(slc: IShellLaunchConfig): boolean {
return !slc.strictEnv && !slc.hideFromUser;
return !slc.strictEnv;
}
15 changes: 13 additions & 2 deletions src/vs/platform/terminal/node/terminalEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,23 @@ export function getShellIntegrationInjection(
logService: ILogService,
productService: IProductService
): IShellIntegrationConfigInjection | undefined {
// Shell integration arg injection is disabled when:
// Conditionally disable shell integration arg injection
// - The global setting is disabled
// - There is no executable (not sure what script to run)
// - The terminal is used by a feature like tasks or debugging
const useWinpty = isWindows && (!options.windowsEnableConpty || getWindowsBuildNumber() < 18309);
if (!options.shellIntegration.enabled || !shellLaunchConfig.executable || (shellLaunchConfig.isFeatureTerminal && !shellLaunchConfig.forceShellIntegration) || shellLaunchConfig.hideFromUser || shellLaunchConfig.ignoreShellIntegration || useWinpty) {
if (
// The global setting is disabled
!options.shellIntegration.enabled ||
// There is no executable (so there's no way to determine how to inject)
!shellLaunchConfig.executable ||
// It's a feature terminal (tasks, debug), unless it's explicitly being forced
(shellLaunchConfig.isFeatureTerminal && !shellLaunchConfig.forceShellIntegration) ||
// The ignoreShellIntegration flag is passed (eg. relaunching without shell integration)
shellLaunchConfig.ignoreShellIntegration ||
// Winpty is unsupported
useWinpty
) {
return undefined;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
throw new ErrorNoTelemetry('Terminal disposed of during xterm.js creation');
}

const disableShellIntegrationReporting = (this.shellLaunchConfig.hideFromUser || this.shellLaunchConfig.executable === undefined || this.shellType === undefined) || !shellIntegrationSupportedShellTypes.includes(this.shellType);
const disableShellIntegrationReporting = (this.shellLaunchConfig.executable === undefined || this.shellType === undefined) || !shellIntegrationSupportedShellTypes.includes(this.shellType);
const xterm = this._scopedInstantiationService.createInstance(
XtermTerminal,
Terminal,
Expand Down

0 comments on commit b3701a9

Please sign in to comment.