Skip to content

Commit d5dda6f

Browse files
committed
Ensure quick pick is closed on view output
Fixes microsoft#141615
1 parent 82dac48 commit d5dda6f

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

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

+15-8
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
766766
const buttons: IQuickInputButton[] = [{
767767
iconClass,
768768
tooltip: nls.localize('viewCommandOutput', "View Command Output"),
769-
alwaysVisible: true
769+
alwaysVisible: true,
770770
}];
771771
items.push({
772772
label,
@@ -784,9 +784,11 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
784784
}
785785
}
786786
const outputProvider = this._instantiationService.createInstance(TerminalOutputProvider);
787-
const result = await this._quickInputService.pick(items.reverse(), {
788-
onDidTriggerItemButton: (async e => {
789-
const selectedCommand = e.item.command;
787+
const quickPick = this._quickInputService.createQuickPick();
788+
quickPick.items = items.reverse();
789+
return new Promise<void>(r => {
790+
quickPick.onDidTriggerItemButton(async e => {
791+
const selectedCommand = (e.item as Item).command;
790792
const output = selectedCommand?.getOutput();
791793
if (output && selectedCommand?.command) {
792794
const textContent = await outputProvider.provideTextContent(URI.from(
@@ -802,11 +804,16 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
802804
});
803805
}
804806
}
805-
})
807+
quickPick.hide();
808+
});
809+
quickPick.onDidAccept(e => {
810+
const result = quickPick.activeItems[0];
811+
this.sendText(type === 'cwd' ? `cd ${result.label}` : result.label, true);
812+
quickPick.hide();
813+
});
814+
quickPick.show();
815+
quickPick.onDidHide(() => r());
806816
});
807-
if (result) {
808-
this.sendText(type === 'cwd' ? `cd ${result.label}` : result.label, true);
809-
}
810817
}
811818

812819
detachFromElement(): void {

0 commit comments

Comments
 (0)