Skip to content

Commit

Permalink
don't show shell integration tooltip for certain terminals (#151172)
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge committed Jun 2, 2022
1 parent 0130815 commit 42b35cb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/vs/workbench/contrib/terminal/browser/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,11 @@ export interface ITerminalInstance {
*/
target?: TerminalLocation;

/**
* Whether or not shell integration telemetry / warnings should be reported for this terminal.
*/
disableShellIntegrationReporting: boolean;

/**
* The id of a persistent process. This is defined if this is a terminal created by a pty host
* that supports reconnection.
Expand Down
11 changes: 8 additions & 3 deletions src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
private _userHome?: string;
private _hasScrollBar?: boolean;
private _target?: TerminalLocation | undefined;
private _disableShellIntegrationReporting: boolean | undefined;

readonly capabilities = new TerminalCapabilityStoreMultiplexer();
readonly statusList: ITerminalStatusList;
Expand All @@ -220,7 +221,12 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
}
this._target = value;
}

get disableShellIntegrationReporting(): boolean {
if (this._disableShellIntegrationReporting === undefined) {
this._disableShellIntegrationReporting = this.shellLaunchConfig.isFeatureTerminal || this.shellLaunchConfig.hideFromUser || this.shellLaunchConfig.executable === undefined;
}
return this._disableShellIntegrationReporting;
}
get instanceId(): number { return this._instanceId; }
get resource(): URI { return this._resource; }
get cols(): number {
Expand Down Expand Up @@ -658,8 +664,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
throw new ErrorNoTelemetry('Terminal disposed of during xterm.js creation');
}

const disableShellIntegrationTelemetry = this.shellLaunchConfig.isFeatureTerminal || this.shellLaunchConfig.hideFromUser || this.shellLaunchConfig.executable === undefined;
const xterm = this._instantiationService.createInstance(XtermTerminal, Terminal, this._configHelper, this._cols, this._rows, this.target || TerminalLocation.Panel, this.capabilities, disableShellIntegrationTelemetry);
const xterm = this._instantiationService.createInstance(XtermTerminal, Terminal, this._configHelper, this._cols, this._rows, this.target || TerminalLocation.Panel, this.capabilities, this.disableShellIntegrationReporting);
this.xterm = xterm;
const lineDataEventAddon = new LineDataEventAddon();
this.xterm.raw.loadAddon(lineDataEventAddon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { TerminalSettingId } from 'vs/platform/terminal/common/terminal';

export function getShellIntegrationTooltip(instance: ITerminalInstance, markdown: boolean, configurationService: IConfigurationService): string {
if (!configurationService.getValue(TerminalSettingId.ShellIntegrationEnabled)) {
if (!configurationService.getValue(TerminalSettingId.ShellIntegrationEnabled) || instance.disableShellIntegrationReporting) {
return '';
}
const shellIntegrationCapabilities: TerminalCapability[] = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal {
rows: number,
location: TerminalLocation,
private readonly _capabilities: ITerminalCapabilityStore,
disableShellIntegrationTelemetry: boolean,
disableShellIntegrationReporting: boolean,
@IConfigurationService private readonly _configurationService: IConfigurationService,
@IInstantiationService private readonly _instantiationService: IInstantiationService,
@ILogService private readonly _logService: ILogService,
Expand Down Expand Up @@ -176,7 +176,7 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal {
this._updateUnicodeVersion();
this._commandNavigationAddon = this._instantiationService.createInstance(CommandNavigationAddon, _capabilities);
this.raw.loadAddon(this._commandNavigationAddon);
this._shellIntegrationAddon = this._instantiationService.createInstance(ShellIntegrationAddon, disableShellIntegrationTelemetry, this._telemetryService);
this._shellIntegrationAddon = this._instantiationService.createInstance(ShellIntegrationAddon, disableShellIntegrationReporting, this._telemetryService);
this.raw.loadAddon(this._shellIntegrationAddon);
this._updateShellIntegrationAddons();
}
Expand Down

0 comments on commit 42b35cb

Please sign in to comment.