Skip to content

Commit

Permalink
Restore active item when filter is cleared (#29096)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrmarti committed Aug 10, 2018
1 parent b9d1534 commit 26a756c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/vs/workbench/browser/parts/quickinput/quickInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,7 @@ export class QuickInputService extends Component implements IQuickInputService {
return;
}
const input = this.createQuickPick<T>();
let activeItem: T;
const disposables = [
input,
input.onDidAccept(() => {
Expand Down Expand Up @@ -1063,6 +1064,11 @@ export class QuickInputService extends Component implements IQuickInputService {
}
}
})),
input.onDidChangeValue(value => {
if (activeItem && !value && (input.activeItems.length !== 1 || input.activeItems[0] !== activeItem)) {
input.activeItems = [activeItem];
}
}),
token.onCancellationRequested(() => {
input.hide();
}),
Expand All @@ -1080,7 +1086,8 @@ export class QuickInputService extends Component implements IQuickInputService {
input.contextKey = options.contextKey;
input.busy = true;
TPromise.join([picks, options.activeItem])
.then(([items, activeItem]) => {
.then(([items, _activeItem]) => {
activeItem = _activeItem;
input.busy = false;
input.items = items;
if (input.canSelectMany) {
Expand Down

0 comments on commit 26a756c

Please sign in to comment.