Skip to content
This repository was archived by the owner on May 20, 2026. It is now read-only.

Add support for CLS to setConfigs mid-runtime#5017

Closed
andreamah wants to merge 2 commits into
microsoft:mainfrom
andreamah:official-goat
Closed

Add support for CLS to setConfigs mid-runtime#5017
andreamah wants to merge 2 commits into
microsoft:mainfrom
andreamah:official-goat

Conversation

@andreamah

@andreamah andreamah commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Adds setConfigs to INESProvider and IInlineCompletionsProvider to ensure that configs can be added. With this, editor reloads don't need to happen for config to refresh.

@andreamah andreamah marked this pull request as ready for review April 6, 2026 23:54
Copilot AI review requested due to automatic review settings April 6, 2026 23:54
@andreamah

Copy link
Copy Markdown
Contributor Author

cc @chrmarti for review

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.

Pull request overview

This PR adds a mid-runtime configuration update pathway to the ChatLib “CLS” providers, so configuration overrides can be refreshed without requiring an editor reload.

Changes:

  • Added setConfigs(overrides: Map<string, unknown>) to INESProvider and IInlineCompletionsProvider.
  • Implemented setConfigs to apply overrides via globalConfigRegistry + IConfigurationService.setConfig.
  • Extended OverridableConfigurationService to support setConfig updates and emit configuration-change events.
Show a summary per file
File Description
src/platform/configuration/common/defaultsOnlyConfigurationService.ts Updates setConfig signature to match the IConfigurationService contract (no-op implementation).
src/lib/node/chatLibMain.ts Adds setConfigs APIs to providers and implements runtime override application + configuration change event propagation.

Copilot's findings

Comments suppressed due to low confidence (1)

src/lib/node/chatLibMain.ts:802

  • InlineCompletionsProvider.setConfigs() now updates both IConfigurationService and (conditionally) the InMemoryConfigProvider. There aren’t tests validating that both configuration layers stay in sync after mid-runtime updates (e.g., a setting affecting GhostText behavior). Consider adding a unit test that calls setConfigs() and verifies a config-dependent code path uses the new value without recreating the provider.
	setConfigs(overrides: Map<string, unknown>) {
		for (const [key, value] of overrides) {
			const config = globalConfigRegistry.configs.get(`${CopilotConfigPrefix}.${key}`);
			if (config) {
				this._configurationService.setConfig(config, value);
			}
		}
		if (this._completionsConfigProvider instanceof InMemoryConfigProvider) {
			this._completionsConfigProvider.setCopilotSettings(Object.fromEntries(overrides));
		}
	}
  • Files reviewed: 2/2 changed files
  • Comments generated: 2

Comment thread src/lib/node/chatLibMain.ts
Comment on lines +352 to +359
setConfigs(overrides: Map<string, unknown>) {
for (const [key, value] of overrides) {
const config = globalConfigRegistry.configs.get(`${CopilotConfigPrefix}.${key}`);
if (config) {
this._configurationService.setConfig(config, value);
}
}
}

Copilot AI Apr 7, 2026

Copy link

Choose a reason for hiding this comment

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

New runtime configuration update behavior is introduced via setConfigs(), but there are no existing tests covering that calling setConfigs() actually changes subsequent provider behavior (or at least emits configuration change events). Adding a targeted unit test in src/lib/vscode-node/test that updates a known config and asserts the provider observes the new value would help prevent regressions.

This issue also appears on line 792 of the same file.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can add tests if necessary :)

@chrmarti

Copy link
Copy Markdown
Collaborator

Merged as microsoft/vscode#308723

@chrmarti chrmarti closed this Apr 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants