Skip to content

Commit a658bc9

Browse files
committed
Add inTerminalRunCommandPicker context key
Fixes microsoft#154306
1 parent e6a60c3 commit a658bc9

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
355355
private readonly _terminalHasFixedWidth: IContextKey<boolean>,
356356
private readonly _terminalShellTypeContextKey: IContextKey<string>,
357357
private readonly _terminalAltBufferActiveContextKey: IContextKey<boolean>,
358+
private readonly _terminalInRunCommandPicker: IContextKey<boolean>,
358359
private readonly _configHelper: TerminalConfigHelper,
359360
private _shellLaunchConfig: IShellLaunchConfig,
360361
resource: URI | undefined,
@@ -1024,7 +1025,11 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
10241025
}
10251026
return new Promise<void>(r => {
10261027
quickPick.show();
1027-
quickPick.onDidHide(() => r());
1028+
this._terminalInRunCommandPicker.set(true);
1029+
quickPick.onDidHide(() => {
1030+
this._terminalInRunCommandPicker.set(false);
1031+
r();
1032+
});
10281033
});
10291034
}
10301035

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export class TerminalInstanceService extends Disposable implements ITerminalInst
2323
private _terminalHasFixedWidth: IContextKey<boolean>;
2424
private _terminalShellTypeContextKey: IContextKey<string>;
2525
private _terminalAltBufferActiveContextKey: IContextKey<boolean>;
26+
private _terminalInRunCommandPicker: IContextKey<boolean>;
2627
private _configHelper: TerminalConfigHelper;
2728

2829
private readonly _onDidCreateInstance = new Emitter<ITerminalInstance>();
@@ -37,6 +38,7 @@ export class TerminalInstanceService extends Disposable implements ITerminalInst
3738
this._terminalHasFixedWidth = TerminalContextKeys.terminalHasFixedWidth.bindTo(this._contextKeyService);
3839
this._terminalShellTypeContextKey = TerminalContextKeys.shellType.bindTo(this._contextKeyService);
3940
this._terminalAltBufferActiveContextKey = TerminalContextKeys.altBufferActive.bindTo(this._contextKeyService);
41+
this._terminalInRunCommandPicker = TerminalContextKeys.inTerminalRunCommandPicker.bindTo(this._contextKeyService);
4042
this._configHelper = _instantiationService.createInstance(TerminalConfigHelper);
4143
}
4244

@@ -49,6 +51,7 @@ export class TerminalInstanceService extends Disposable implements ITerminalInst
4951
this._terminalHasFixedWidth,
5052
this._terminalShellTypeContextKey,
5153
this._terminalAltBufferActiveContextKey,
54+
this._terminalInRunCommandPicker,
5255
this._configHelper,
5356
shellLaunchConfig,
5457
resource

src/vs/workbench/contrib/terminal/common/terminalContextKey.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export const enum TerminalContextKeyStrings {
3131
TabsSingularSelection = 'terminalTabsSingularSelection',
3232
SplitTerminal = 'terminalSplitTerminal',
3333
ShellType = 'terminalShellType',
34+
InTerminalRunCommandPicker = 'inTerminalRunCommandPicker',
3435
}
3536

3637
export namespace TerminalContextKeys {
@@ -119,4 +120,7 @@ export namespace TerminalContextKeys {
119120

120121
/** Whether the focused tab's terminal is a split terminal. */
121122
export const splitTerminal = new RawContextKey<boolean>(TerminalContextKeyStrings.SplitTerminal, false, localize('isSplitTerminalContextKey', "Whether the focused tab's terminal is a split terminal."));
123+
124+
/** Whether the terminal run command picker is currently open. */
125+
export const inTerminalRunCommandPicker = new RawContextKey<boolean>(TerminalContextKeyStrings.InTerminalRunCommandPicker, false, localize('inTerminalRunCommandPickerContextKey', "Whether the terminal run command picker is currently open."));
122126
}

0 commit comments

Comments
 (0)