Skip to content

agents: fire configuration changes when workspace folders bring or take settings - #350602

Open
Sandeep Somavarapu (sandy081) wants to merge 1 commit into
mainfrom
sandy081/agents/agents-config-added-folder-settings
Open

Sandeep Somavarapu (sandy081) wants to merge 1 commit into
mainfrom
sandy081/agents/agents-config-added-folder-settings

Conversation

@sandy081

Copy link
Copy Markdown
Member

What: In the Agents window, .vscode/settings.json of a folder that gets mounted now reaches already-open editors for files in that folder. Removing the folder also notifies them correctly. Before this, adding was silent, and on removal affectsConfiguration(key, { resource }) returned false for files in the removed folder.

Changes:

  • AgentsConfigurationService: computes the change when added folders load (in onWillChangeWorkspaceFolders) and fires it in onDidChangeWorkspaceFolders, merged with removals.
  • The pending change is keyed to the folders-change event (WeakMap), so a change that never completes doesn't leak into the next one.
  • The event's "previous" state is a snapshot of the configuration and the workspace folders from before the change. The workspace is updated in place, so without the snapshot, per-resource checks re-resolve against the new folders.
  • Initialization stays silent.
  • Tests: added and removed folders, including a folder with only [typescript] settings, checked with affectsConfiguration with a resource and an override identifier. Plus a silent initialize test.

Validation:

  • ./scripts/test.sh --run src/vs/workbench/services/configuration/test/browser/agents/agentsConfigurationService.test.ts: 64 passing. Without the fix, the 2 new add/remove tests fail.
  • ./scripts/test.sh --runGlob "vs/workbench/services/configuration/test/browser/**/*.test.js": 313 passing, 7 pending.
  • npm run typecheck-client, npm run valid-layers-check, npm run oxlint on the changed files: passed.

Written by GitHub Copilot on behalf of Sandeep Somavarapu (@sandy081)

Settings of added folders were applied silently while the folders were
being added, so editors on files in a mounted folder kept stale values.
Removals did fire, but the event compared against the already-updated
workspace, so `affectsConfiguration(key, { resource })` for a file in
the removed folder returned false.

The change for added folders is now computed when they load and fired
once the folders change, keyed to that change, against the configuration
and folders from before it. Initialization stays silent.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 26, 2026 21:40
@sandy081 Sandeep Somavarapu (sandy081) added this to the 1.149.0 milestone Nov 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the workspace-folder configuration notification changes.

No open issues 🎉

What changed in this PR

Fixes configuration-change notifications in the Agents window so already-open editors receive folder settings when workspace folders are added or removed.

Changes:

  • Tracks added-folder configuration changes per workspace-folder event and merges them with removals.
  • Snapshots the previous configuration and workspace folders so resource-specific change checks remain accurate.
  • Adds regression tests for folder settings, language overrides, and silent initialization.
File Description
src/​vs/​workbench/​services/​configuration/​test/​browser/​agents/​agentsConfigurationService.test.ts Tests add/remove notifications, language-only settings, and silent initialization.
src/​vs/​workbench/​services/​configuration/​browser/​agents/​agentsConfigurationService.ts Collects folder configuration changes and preserves prior workspace state for accurate notifications.

Review effort: Balanced

@sandy081
Sandeep Somavarapu (sandy081) marked this pull request as ready for review November 26, 2026 21:50

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants