Skip to content

Commit

Permalink
Fix #80369
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Sep 5, 2019
1 parent 44ac060 commit 6581d60
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
}
Expand Down
16 changes: 6 additions & 10 deletions src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean>('nonEmptyWorkspace', false);
const DefaultViewsContext = new RawContextKey<boolean>('defaultExtensionViews', true);
const SearchMarketplaceExtensionsContext = new RawContextKey<boolean>('searchMarketplaceExtensions', false);
Expand Down Expand Up @@ -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();
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/extensions/common/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const VIEW_CONTAINER: ViewContainer = Registry.as<IViewContainersRegistry
export const EXTENSIONS_CONFIG = '.vscode/extensions.json';

export interface IExtensionsViewlet extends IViewlet {
search(text: string): void;
search(text: string, refresh?: boolean): void;
}

export const enum ExtensionState {
Expand Down

0 comments on commit 6581d60

Please sign in to comment.