From 6581d602aa03e7b9cc51c9adb650f6cd766792d3 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 5 Sep 2019 11:53:06 +0200 Subject: [PATCH] Fix #80369 --- .../extensions/browser/extensionsActions.ts | 2 +- .../extensions/browser/extensionsViewlet.ts | 16 ++++++---------- .../contrib/extensions/common/extensions.ts | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts b/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts index 71a2b755343bb..fbdabd31fd46e 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsActions.ts @@ -1605,7 +1605,7 @@ export class ShowRecommendedExtensionsAction extends Action { return this.viewletService.openViewlet(VIEWLET_ID, true) .then(viewlet => viewlet as IExtensionsViewlet) .then(viewlet => { - viewlet.search('@recommended '); + viewlet.search('@recommended ', true); viewlet.focus(); }); } diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts b/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts index d9aef35dae5be..b4b05abc5ecec 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts @@ -59,11 +59,6 @@ import { RemoteNameContext } from 'vs/workbench/browser/contextkeys'; import { ILabelService } from 'vs/platform/label/common/label'; import { MementoObject } from 'vs/workbench/common/memento'; -interface SearchInputEvent extends Event { - target: HTMLInputElement; - immediate?: boolean; -} - const NonEmptyWorkspaceContext = new RawContextKey('nonEmptyWorkspace', false); const DefaultViewsContext = new RawContextKey('defaultExtensionViews', true); const SearchMarketplaceExtensionsContext = new RawContextKey('searchMarketplaceExtensions', false); @@ -488,12 +483,13 @@ export class ExtensionsViewlet extends ViewContainerViewlet implements IExtensio return this.secondaryActions; } - search(value: string): void { + search(value: string, refresh: boolean = false): void { if (this.searchBox) { - const event = new Event('input', { bubbles: true }) as SearchInputEvent; - event.immediate = true; - - this.searchBox.setValue(value); + if (this.searchBox.getValue() !== value) { + this.searchBox.setValue(value); + } else if (refresh) { + this.doSearch(); + } } } diff --git a/src/vs/workbench/contrib/extensions/common/extensions.ts b/src/vs/workbench/contrib/extensions/common/extensions.ts index 126a008a66bb9..402f9e0a2fe9c 100644 --- a/src/vs/workbench/contrib/extensions/common/extensions.ts +++ b/src/vs/workbench/contrib/extensions/common/extensions.ts @@ -23,7 +23,7 @@ export const VIEW_CONTAINER: ViewContainer = Registry.as