Skip to content

Commit

Permalink
Settings editor should expand TOC when entering filter mode, same as …
Browse files Browse the repository at this point in the history
…search
  • Loading branch information
roblourens committed Aug 29, 2018
1 parent ea42fca commit 38c2b6f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/vs/workbench/parts/preferences/browser/settingsEditor2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ export class SettingsEditor2 extends BaseEditor {
return TPromise.as(null);
}

private toggleSearchMode(): void {
private onSearchModeToggled(): void {
DOM.removeClass(this.rootElement, 'search-mode');
if (this.configurationService.getValue('workbench.settings.settingsSearchTocBehavior') === 'hide') {
DOM.toggleClass(this.rootElement, 'search-mode', !!this.searchResultModel);
Expand Down Expand Up @@ -847,12 +847,16 @@ export class SettingsEditor2 extends BaseEditor {
this.viewState.filterToCategory = null;
this.tocTreeModel.currentSearchModel = this.searchResultModel;
this.tocTree.refresh();
this.toggleSearchMode();
collapseAll(this.tocTree);
this.onSearchModeToggled();

if (this.searchResultModel) {
// Added a filter model
this.tocTree.setSelection([]);
expandAll(this.tocTree);
return this.settingsTree.setInput(this.searchResultModel.root).then(() => this.renderResultCountMessages());
} else {
// Leaving search mode
collapseAll(this.tocTree);
return this.settingsTree.setInput(this.settingsTreeModel.root).then(() => this.renderResultCountMessages());
}
}
Expand Down Expand Up @@ -970,14 +974,13 @@ export class SettingsEditor2 extends BaseEditor {
this.searchResultModel = this.instantiationService.createInstance(SearchResultModel, this.viewState);
this.searchResultModel.setResult(type, result);
this.tocTreeModel.currentSearchModel = this.searchResultModel;
this.toggleSearchMode();
this.onSearchModeToggled();
this.settingsTree.setInput(this.searchResultModel.root);
} else {
this.tocTreeModel.update();
this.searchResultModel.setResult(type, result);
}


this.tocTree.setSelection([]);
expandAll(this.tocTree);

Expand Down

0 comments on commit 38c2b6f

Please sign in to comment.