Repository navigation
fix #310143 - #310840
fix #310143#310840
Conversation
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Pull request overview
Adjusts how enabling/disabling built-in AI features (Copilot/chat) is coordinated between extension enablement state and the chat.disableAIFeatures setting, particularly for workspace-vs-global behavior.
Changes:
- Refines enablement-UI logic for “Enable AI Features” actions in the Extensions view using
IConfigurationService.inspect(...)andConfigurationTarget. - Updates chat teardown/extension-change handling to avoid unintentionally flipping global settings when workspace enablement changes.
- Adds configuration-change listeners so action enablement updates when
chat.disableAIFeatureschanges.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/extensions/browser/extensionsActions.ts | Updates “Enable AI Features” actions to consult inspected config values and selectively write workspace overrides. |
| src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.ts | Adjusts teardown extension-change behavior to write workspace vs global config depending on workspace enablement state. |
Copilot's findings
Comments suppressed due to low confidence (1)
src/vs/workbench/contrib/extensions/browser/extensionsActions.ts:1897
EnableAIFeaturesInWorkspaceAction.run()only clearschat.disableAIFeatureswhenworkspaceValue === true. If AI is disabled via user/global settings (inspect.value === truewithworkspaceValueundefined), enabling the extension for the workspace won’t actually re-enable AI features because the effective setting remainstrue. Consider updating the workspace setting tofalsewhenever the effective value istrue(or wheneverworkspaceValue !== false) so the workspace enable action reliably overrides a global disable.
await this.extensionsWorkbenchService.setEnablement(this.extension, EnablementState.EnabledWorkspace);
if (this.configurationService.inspect(CHAT_AI_DISABLED_SETTING).workspaceValue === true) {
await this.configurationService.updateValue(CHAT_AI_DISABLED_SETTING, false, ConfigurationTarget.WORKSPACE);
}
- Files reviewed: 2/2 changed files
- Comments generated: 2
| const inspect = this.configurationService.inspect(CHAT_AI_DISABLED_SETTING); | ||
| if (inspect.value === false) { | ||
| return; | ||
| } | ||
| if (inspect?.workspaceValue === true) { | ||
| this.enabled = true; | ||
| return; | ||
| } | ||
| if (this.extension.enablementState === EnablementState.EnabledWorkspace) { | ||
| return; | ||
| } | ||
| this.enabled = true; | ||
| return; |
There was a problem hiding this comment.
EnableAIFeaturesInWorkspaceAction.update() is now gated on inspect.value !== false, which means the action won’t be available when the chat extension is disabled for the workspace but the chat.disableAIFeatures setting is still false (e.g. after using “Disable AI Features (Workspace)”, which only changes extension enablement). This can leave users without a way to re-enable AI features from the extensions UI. Consider also enabling this action when this.extension.enablementState === EnablementState.DisabledWorkspace (or switching the disable/enable pair to consistently toggle the setting rather than only enablement).
This issue also appears on line 1894 of the same file.
| if (defaultChatExtension.enablementState === EnablementState.EnabledWorkspace) { | ||
| if (this.configurationService.inspect(ChatConfiguration.AIDisabled).workspaceValue === true) { | ||
| this.configurationService.updateValue(ChatConfiguration.AIDisabled, false, ConfigurationTarget.WORKSPACE); | ||
| } | ||
| } else { | ||
| this.configurationService.updateValue(ChatConfiguration.AIDisabled, false); | ||
| } |
There was a problem hiding this comment.
In ChatTeardownContribution’s extension-change handler, when the chat extension ends up EnabledWorkspace you only clear chat.disableAIFeatures if workspaceValue === true. If AI was disabled globally (so value === true with no workspace override) and the user enables the extension in this workspace, the effective setting stays true and AI features remain disabled. Consider setting chat.disableAIFeatures to false at ConfigurationTarget.WORKSPACE whenever the extension is EnabledWorkspace and the effective config value is true, so workspace-enablement reliably overrides a global disable without flipping the global setting.
No description provided.