Skip to content
This repository was archived by the owner on May 20, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 45 additions & 2 deletions src/lib/node/chatLibMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ import { IChatQuotaService } from '../../platform/chat/common/chatQuotaService';
import { ChatQuotaService } from '../../platform/chat/common/chatQuotaServiceImpl';
import { IConversationOptions } from '../../platform/chat/common/conversationOptions';
import { IInteractionService, InteractionService } from '../../platform/chat/common/interactionService';
import { BaseConfig, Config, ConfigKey, ExperimentBasedConfig, ExperimentBasedConfigType, IConfigurationService } from '../../platform/configuration/common/configurationService';
import { BaseConfig, Config, ConfigKey, CopilotConfigPrefix, ExperimentBasedConfig, ExperimentBasedConfigType, globalConfigRegistry, IConfigurationService } from '../../platform/configuration/common/configurationService';
import { DefaultsOnlyConfigurationService } from '../../platform/configuration/common/defaultsOnlyConfigurationService';
import { IDiffService } from '../../platform/diff/common/diffService';
import { DiffServiceImpl } from '../../platform/diff/node/diffServiceImpl';
Expand Down Expand Up @@ -208,6 +208,7 @@ export interface INESProvider<T extends INESResult = INESResult> {
handleRejection(suggestion: T): void;
handleIgnored(suggestion: T, supersededByRequestUuid: T | undefined): void;
updateTreatmentVariables(variables: Record<string, boolean | number | string>): void;
setConfigs(overrides: Map<string, unknown>): void;
dispose(): void;
}

Expand Down Expand Up @@ -348,6 +349,15 @@ class NESProvider extends Disposable implements INESProvider<NESResult> {
}
}

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);
}
}
}
Comment on lines +352 to +359

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 :)


}

function setupServices(options: INESProviderOptions) {
Expand Down Expand Up @@ -402,8 +412,26 @@ function setupServices(options: INESProviderOptions) {
}

class OverridableConfigurationService extends DefaultsOnlyConfigurationService {
constructor(private readonly _overrides: Map<string, unknown>) {
private _overrides: Map<string, unknown>;

constructor(overrides: Map<string, unknown>) {
super();
this._overrides = overrides;
}

override async setConfig<T>(key: BaseConfig<T>, value: T): Promise<void> {
const existing = this._overrides.get(key.id);
if (existing === value) {
return;
}
this._overrides.set(key.id, value);
const fullyQualifiedKey = key.fullyQualifiedId;
this._onDidChangeConfiguration.fire({
affectsConfiguration: (section) => {
return fullyQualifiedKey === section || fullyQualifiedKey.startsWith(section + '.') || section.startsWith(fullyQualifiedKey + '.');
}
});
return;
Comment thread
andreamah marked this conversation as resolved.
}

override getConfig<T>(key: Config<T>): T {
Expand Down Expand Up @@ -727,6 +755,7 @@ export type IGetInlineCompletionsOptions = Exclude<Partial<GetGhostTextOptions>,

export interface IInlineCompletionsProvider {
updateTreatmentVariables(variables: Record<string, boolean | number | string>): void;
setConfigs(overrides: Map<string, unknown>): void;
getInlineCompletions(textDocument: ITextDocument, position: Position, token?: CancellationToken, options?: IGetInlineCompletionsOptions): Promise<CopilotCompletion[] | undefined>;
inlineCompletionShown(completionId: string): Promise<void>;
dispose(): void;
Expand All @@ -746,6 +775,8 @@ class InlineCompletionsProvider extends Disposable implements IInlineCompletions
@IExperimentationService private readonly _expService: IExperimentationService,
@ICompletionsSpeculativeRequestCache private readonly _speculativeRequestCache: ICompletionsSpeculativeRequestCache,
@ILogService private readonly _logService: ILogService,
@IConfigurationService private readonly _configurationService: IConfigurationService,
@ICompletionsConfigProvider private readonly _completionsConfigProvider: ICompletionsConfigProvider,
) {
super();
this._register(_insta);
Expand All @@ -758,6 +789,18 @@ class InlineCompletionsProvider extends Disposable implements IInlineCompletions
}
}

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));
}
}

async getInlineCompletions(textDocument: ITextDocument, position: Position, token?: CancellationToken, options?: IGetInlineCompletionsOptions): Promise<CopilotCompletion[] | undefined> {
const telemetryBuilder = new LlmNESTelemetryBuilder(undefined, undefined, undefined, 'ghostText', undefined);
return await this.ghostText.getInlineCompletions(textDocument, position, token ?? CancellationToken.None, options, new GhostTextLogContext(textDocument.uri, textDocument.version, undefined), telemetryBuilder, this._logService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class DefaultsOnlyConfigurationService extends AbstractConfigurationServi
};
}

override setConfig(): Promise<void> {
override setConfig<T>(key: BaseConfig<T>, value: T): Promise<void> {
return Promise.resolve();
}

Expand Down
Loading