From 424dcb6dc9eac81f5b687dfb0e8e8e28f0c7e48e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 26 Jan 2026 23:25:08 +0000 Subject: [PATCH 1/4] Initial plan From 82003f4e6c03a78e2fc1f1f9961a1e6319014c41 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 26 Jan 2026 23:31:48 +0000 Subject: [PATCH 2/4] Fix settings editor double render when opening with filter When opening settings editor with a filter (e.g., "Preferences: Open Accessibility Settings"), apply the filter before the initial render to prevent showing all settings briefly before filtering down to the requested subset. The fix checks if there's a query in viewState but no searchResultModel yet, and if so, triggers onSearchInputChanged before rendering to ensure the filtered model is used for the initial render. Co-authored-by: rzhao271 <7199958+rzhao271@users.noreply.github.com> --- .../contrib/preferences/browser/settingsEditor2.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts index db818b4376494..3dab6b2b7badc 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts @@ -1634,6 +1634,14 @@ export class SettingsEditor2 extends EditorPane { return await this.onSearchInputChanged(false); } + // If there's a query present (e.g., opening with a filter like @tag:accessibility), + // trigger the search before rendering to avoid showing all settings first + if (this.viewState.query && !this.searchResultModel) { + await this.onSearchInputChanged(true); + // onSearchInputChanged already handles refreshing TOC and rendering the tree + return; + } + this.refreshTOCTree(); this.renderTree(undefined, forceRefresh); From 241a8ed4b366ea0b0caa7e9a4d777af82a37a2cd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 26 Jan 2026 23:35:28 +0000 Subject: [PATCH 3/4] Add skipInitialSearch guard to prevent recursion When triggerSearch calls onConfigUpdate to rebuild the tree for advanced filter changes, we need to skip the initial search logic to avoid infinite recursion. Co-authored-by: rzhao271 <7199958+rzhao271@users.noreply.github.com> --- .../contrib/preferences/browser/settingsEditor2.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts index 3dab6b2b7badc..d8effaf8503cc 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts @@ -1464,7 +1464,7 @@ export class SettingsEditor2 extends EditorPane { this.settingsOrderByTocIndex = this.createSettingsOrderByTocIndex(resolvedSettingsRoot); } - private async onConfigUpdate(keys?: ReadonlySet, forceRefresh = false, triggerSearch = false): Promise { + private async onConfigUpdate(keys?: ReadonlySet, forceRefresh = false, triggerSearch = false, skipInitialSearch = false): Promise { if (keys && this.settingsTreeModel) { return this.updateElementsByKey(keys); } @@ -1636,7 +1636,7 @@ export class SettingsEditor2 extends EditorPane { // If there's a query present (e.g., opening with a filter like @tag:accessibility), // trigger the search before rendering to avoid showing all settings first - if (this.viewState.query && !this.searchResultModel) { + if (!skipInitialSearch && this.viewState.query && !this.searchResultModel) { await this.onSearchInputChanged(true); // onSearchInputChanged already handles refreshing TOC and rendering the tree return; @@ -1871,7 +1871,7 @@ export class SettingsEditor2 extends EditorPane { } if (showAdvanced !== this.viewState.tagFilters?.has(ADVANCED_SETTING_TAG)) { - await this.onConfigUpdate(); + await this.onConfigUpdate(undefined, false, false, true); } this.settingsTargetsWidget.updateLanguageFilterIndicators(this.viewState.languageFilter); From 03e580b5442a658a0cd640c64fa839592f326023 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 26 Jan 2026 23:38:47 +0000 Subject: [PATCH 4/4] Use searchWidget.getValue() for better query validation Use searchWidget.getValue() instead of viewState.query to check if there's a search query. This is more robust as getValue() returns the trimmed value, avoiding triggering unnecessary searches for empty or whitespace-only queries. This also matches the pattern used in the existing code (else branch). Co-authored-by: rzhao271 <7199958+rzhao271@users.noreply.github.com> --- src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts index d8effaf8503cc..c4b6dc66bc663 100644 --- a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts +++ b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts @@ -1636,7 +1636,7 @@ export class SettingsEditor2 extends EditorPane { // If there's a query present (e.g., opening with a filter like @tag:accessibility), // trigger the search before rendering to avoid showing all settings first - if (!skipInitialSearch && this.viewState.query && !this.searchResultModel) { + if (!skipInitialSearch && this.searchWidget.getValue() && !this.searchResultModel) { await this.onSearchInputChanged(true); // onSearchInputChanged already handles refreshing TOC and rendering the tree return;