Skip to content

Commit

Permalink
Merge pull request #141650 from microsoft/tyriar/141615
Browse files Browse the repository at this point in the history
Ensure quick pick is closed on view output
  • Loading branch information
Tyriar authored Jan 27, 2022
2 parents 3cc9dd4 + 4c83b11 commit 9b0917d
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -784,9 +784,11 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
}
}
const outputProvider = this._instantiationService.createInstance(TerminalOutputProvider);
const result = await this._quickInputService.pick(items.reverse(), {
onDidTriggerItemButton: (async e => {
const selectedCommand = e.item.command;
const quickPick = this._quickInputService.createQuickPick();
quickPick.items = items.reverse();
return new Promise<void>(r => {
quickPick.onDidTriggerItemButton(async e => {
const selectedCommand = (e.item as Item).command;
const output = selectedCommand?.getOutput();
if (output && selectedCommand?.command) {
const textContent = await outputProvider.provideTextContent(URI.from(
Expand All @@ -797,16 +799,21 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
query: `terminal-output-${selectedCommand.timestamp}-${this.instanceId}`
}));
if (textContent) {
this._editorService.openEditor({
await this._editorService.openEditor({
resource: textContent.uri
});
}
}
})
quickPick.hide();
});
quickPick.onDidAccept(e => {
const result = quickPick.activeItems[0];
this.sendText(type === 'cwd' ? `cd ${result.label}` : result.label, true);
quickPick.hide();
});
quickPick.show();
quickPick.onDidHide(() => r());
});
if (result) {
this.sendText(type === 'cwd' ? `cd ${result.label}` : result.label, true);
}
}

detachFromElement(): void {
Expand Down

0 comments on commit 9b0917d

Please sign in to comment.