Skip to content

Commit 488651b

Browse files
authored
Show the new extensions button less often (microsoft#167019)
Fixes microsoft#153585
1 parent 6e8c7df commit 488651b

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/vs/workbench/contrib/preferences/browser/settingsTree.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2096,7 +2096,7 @@ export class SettingsTreeFilter implements ITreeFilter<SettingsTreeElement> {
20962096

20972097
// Filtered "new extensions" button
20982098
if (element instanceof SettingsTreeNewExtensionsElement) {
2099-
if ((this.viewState.tagFilters && this.viewState.tagFilters.size) || this.viewState.filterToCategory) {
2099+
if (this.viewState.tagFilters?.size || this.viewState.filterToCategory) {
21002100
return false;
21012101
}
21022102
}

src/vs/workbench/contrib/preferences/browser/settingsTreeModels.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -884,15 +884,18 @@ export class SearchResultModel extends SettingsTreeModel {
884884
this.root.children = this.root.children
885885
.filter(child => child instanceof SettingsTreeSettingElement && child.matchesAllTags(this._viewState.tagFilters) && child.matchesScope(this._viewState.settingsTarget, isRemote) && child.matchesAnyExtension(this._viewState.extensionFilters) && child.matchesAnyId(this._viewState.idFilters) && child.matchesAnyFeature(this._viewState.featureFilters) && child.matchesAllLanguages(this._viewState.languageFilter));
886886

887-
if (this.newExtensionSearchResults && this.newExtensionSearchResults.filterMatches.length) {
888-
const resultExtensionIds = this.newExtensionSearchResults.filterMatches
887+
if (this.newExtensionSearchResults?.filterMatches.length) {
888+
let resultExtensionIds = this.newExtensionSearchResults.filterMatches
889889
.map(result => (<IExtensionSetting>result.setting))
890890
.filter(setting => setting.extensionName && setting.extensionPublisher)
891891
.map(setting => `${setting.extensionPublisher}.${setting.extensionName}`);
892+
resultExtensionIds = arrays.distinct(resultExtensionIds);
892893

893-
const newExtElement = new SettingsTreeNewExtensionsElement('newExtensions', arrays.distinct(resultExtensionIds));
894-
newExtElement.parent = this._root;
895-
this._root.children.push(newExtElement);
894+
if (resultExtensionIds.length) {
895+
const newExtElement = new SettingsTreeNewExtensionsElement('newExtensions', resultExtensionIds);
896+
newExtElement.parent = this._root;
897+
this._root.children.push(newExtElement);
898+
}
896899
}
897900
}
898901

0 commit comments

Comments
 (0)