Skip to content

Commit 42b35cb

Browse files
authored
don't show shell integration tooltip for certain terminals (microsoft#151172)
1 parent 0130815 commit 42b35cb

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

src/vs/workbench/contrib/terminal/browser/terminal.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,11 @@ export interface ITerminalInstance {
458458
*/
459459
target?: TerminalLocation;
460460

461+
/**
462+
* Whether or not shell integration telemetry / warnings should be reported for this terminal.
463+
*/
464+
disableShellIntegrationReporting: boolean;
465+
461466
/**
462467
* The id of a persistent process. This is defined if this is a terminal created by a pty host
463468
* that supports reconnection.

src/vs/workbench/contrib/terminal/browser/terminalInstance.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
206206
private _userHome?: string;
207207
private _hasScrollBar?: boolean;
208208
private _target?: TerminalLocation | undefined;
209+
private _disableShellIntegrationReporting: boolean | undefined;
209210

210211
readonly capabilities = new TerminalCapabilityStoreMultiplexer();
211212
readonly statusList: ITerminalStatusList;
@@ -220,7 +221,12 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
220221
}
221222
this._target = value;
222223
}
223-
224+
get disableShellIntegrationReporting(): boolean {
225+
if (this._disableShellIntegrationReporting === undefined) {
226+
this._disableShellIntegrationReporting = this.shellLaunchConfig.isFeatureTerminal || this.shellLaunchConfig.hideFromUser || this.shellLaunchConfig.executable === undefined;
227+
}
228+
return this._disableShellIntegrationReporting;
229+
}
224230
get instanceId(): number { return this._instanceId; }
225231
get resource(): URI { return this._resource; }
226232
get cols(): number {
@@ -658,8 +664,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
658664
throw new ErrorNoTelemetry('Terminal disposed of during xterm.js creation');
659665
}
660666

661-
const disableShellIntegrationTelemetry = this.shellLaunchConfig.isFeatureTerminal || this.shellLaunchConfig.hideFromUser || this.shellLaunchConfig.executable === undefined;
662-
const xterm = this._instantiationService.createInstance(XtermTerminal, Terminal, this._configHelper, this._cols, this._rows, this.target || TerminalLocation.Panel, this.capabilities, disableShellIntegrationTelemetry);
667+
const xterm = this._instantiationService.createInstance(XtermTerminal, Terminal, this._configHelper, this._cols, this._rows, this.target || TerminalLocation.Panel, this.capabilities, this.disableShellIntegrationReporting);
663668
this.xterm = xterm;
664669
const lineDataEventAddon = new LineDataEventAddon();
665670
this.xterm.raw.loadAddon(lineDataEventAddon);

src/vs/workbench/contrib/terminal/browser/terminalTooltip.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
1010
import { TerminalSettingId } from 'vs/platform/terminal/common/terminal';
1111

1212
export function getShellIntegrationTooltip(instance: ITerminalInstance, markdown: boolean, configurationService: IConfigurationService): string {
13-
if (!configurationService.getValue(TerminalSettingId.ShellIntegrationEnabled)) {
13+
if (!configurationService.getValue(TerminalSettingId.ShellIntegrationEnabled) || instance.disableShellIntegrationReporting) {
1414
return '';
1515
}
1616
const shellIntegrationCapabilities: TerminalCapability[] = [];

src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal {
9999
rows: number,
100100
location: TerminalLocation,
101101
private readonly _capabilities: ITerminalCapabilityStore,
102-
disableShellIntegrationTelemetry: boolean,
102+
disableShellIntegrationReporting: boolean,
103103
@IConfigurationService private readonly _configurationService: IConfigurationService,
104104
@IInstantiationService private readonly _instantiationService: IInstantiationService,
105105
@ILogService private readonly _logService: ILogService,
@@ -176,7 +176,7 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal {
176176
this._updateUnicodeVersion();
177177
this._commandNavigationAddon = this._instantiationService.createInstance(CommandNavigationAddon, _capabilities);
178178
this.raw.loadAddon(this._commandNavigationAddon);
179-
this._shellIntegrationAddon = this._instantiationService.createInstance(ShellIntegrationAddon, disableShellIntegrationTelemetry, this._telemetryService);
179+
this._shellIntegrationAddon = this._instantiationService.createInstance(ShellIntegrationAddon, disableShellIntegrationReporting, this._telemetryService);
180180
this.raw.loadAddon(this._shellIntegrationAddon);
181181
this._updateShellIntegrationAddons();
182182
}

0 commit comments

Comments
 (0)