diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts b/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts index 1998414..cdc533b 100644 --- a/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts +++ b/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts @@ -206,3 +206,4 @@ abstract class OpenChatGlobalAction extends Action2 { ChatContextKeys.Setup.hidden.negate(), - ChatContextKeys.Setup.disabled.negate() + ChatContextKeys.Setup.disabled.negate(), + ContextKeyExpr.has('config.chat.disableAIFeatures').negate() ) @@ -1142,3 +1143,3 @@ export function registerChatActions() { precondition: ContextKeyExpr.and( - ChatContextKeys.Setup.installed, + ContextKeyExpr.has('config.chat.disableAIFeatures').negate(), ChatContextKeys.Setup.disabled.negate(), @@ -1715,3 +1716,4 @@ MenuRegistry.appendMenuItem(MenuId.EditorContext, { ChatContextKeys.Setup.hidden.negate(), - ChatContextKeys.Setup.disabled.negate() + ChatContextKeys.Setup.disabled.negate(), + ContextKeyExpr.has('config.chat.disableAIFeatures').negate() ) diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.ts b/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.ts index b8c8e03..512e40f 100644 --- a/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.ts +++ b/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.ts @@ -314,3 +314,4 @@ class AttachSelectionToChatAction extends Action2 { ResourceContextKey.Scheme.isEqualTo(Schemas.vscodeUserData) - ) + ), + ContextKeyExpr.has('config.chat.disableAIFeatures').negate(), ) diff --git a/src/vs/workbench/contrib/chat/browser/chat.contribution.ts b/src/vs/workbench/contrib/chat/browser/chat.contribution.ts index be62dda..7b5f1ed 100644 --- a/src/vs/workbench/contrib/chat/browser/chat.contribution.ts +++ b/src/vs/workbench/contrib/chat/browser/chat.contribution.ts @@ -1237,3 +1237,3 @@ configurationRegistry.registerConfiguration({ description: nls.localize('chat.disableAIFeatures', "Disable and hide built-in AI features provided by GitHub Copilot, including chat and inline suggestions."), - default: false, + default: true, scope: ConfigurationScope.WINDOW diff --git a/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.ts b/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.ts index ddb5df4..7831288 100644 --- a/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.ts +++ b/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.ts @@ -70,10 +70,9 @@ const chatViewDescriptor: IViewDescriptor = { ctorDescriptor: new SyncDescriptor(ChatViewPane), - when: ContextKeyExpr.or( - ContextKeyExpr.or( - ChatContextKeys.Setup.hidden, - ChatContextKeys.Setup.disabled - )?.negate(), - ChatContextKeys.panelParticipantRegistered, - ChatContextKeys.extensionInvalid - ) + when: ContextKeyExpr.and( + ContextKeyExpr.has('config.chat.disableAIFeatures').negate(), + ChatContextKeys.Setup.disabled.negate(), + ChatContextKeys.Setup.hidden.negate(), + ChatContextKeys.panelParticipantRegistered, + ChatContextKeys.extensionInvalid.negate() + ) }; diff --git a/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.ts b/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.ts index 4a71579..f8b3e83 100644 --- a/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.ts +++ b/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.ts @@ -228,2 +228,3 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr ChatContextKeys.Setup.untrusted, + ContextKeyExpr.has('config.chat.disableAIFeatures').negate(), ChatContextKeys.Setup.installed.negate(), @@ -346,2 +347,3 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr ChatContextKeys.Setup.hidden.negate(), + ContextKeyExpr.has('config.chat.disableAIFeatures').negate(), ChatContextKeys.Setup.installed.negate(), @@ -518,2 +520,3 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr ChatContextKeys.Setup.disabled.negate(), + ContextKeyExpr.has('config.chat.disableAIFeatures').negate(), ChatContextKeys.Setup.installed.negate(), diff --git a/src/vs/workbench/contrib/chat/common/actions/chatContextKeys.ts b/src/vs/workbench/contrib/chat/common/actions/chatContextKeys.ts index c8fc17b..fbd2afd 100644 --- a/src/vs/workbench/contrib/chat/common/actions/chatContextKeys.ts +++ b/src/vs/workbench/contrib/chat/common/actions/chatContextKeys.ts @@ -163,3 +163,3 @@ export namespace ChatContextKeyExprs { export const chatSetupTriggerContext = ContextKeyExpr.or( - ChatContextKeys.Setup.installed.negate(), + ContextKeyExpr.has('config.chat.disableAIFeatures').negate(), ChatContextKeys.Entitlement.canSignUp diff --git a/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.ts b/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.ts index e9b4077..b33d6f2 100644 --- a/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.ts +++ b/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.ts @@ -133,3 +133,9 @@ MenuRegistry.appendMenuItem(MenuId.InlineChatEditorAffordance, { order: 1, - when: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasNonEmptySelection, CTX_INLINE_CHAT_FILE_BELONGS_TO_CHAT.negate(), ChatEntitlementContextKeys.Setup.hidden.negate()), + when: ContextKeyExpr.and( + EditorContextKeys.writable, + EditorContextKeys.hasNonEmptySelection, + CTX_INLINE_CHAT_FILE_BELONGS_TO_CHAT.negate(), + ChatEntitlementContextKeys.Setup.hidden.negate(), + ContextKeyExpr.has('config.chat.disableAIFeatures').negate(), + ), command: { diff --git a/src/vs/workbench/contrib/mcp/browser/mcpServersView.ts b/src/vs/workbench/contrib/mcp/browser/mcpServersView.ts index 864cc4f..b877a8e 100644 --- a/src/vs/workbench/contrib/mcp/browser/mcpServersView.ts +++ b/src/vs/workbench/contrib/mcp/browser/mcpServersView.ts @@ -554,3 +554,3 @@ export class McpServersViewsContribution extends Disposable implements IWorkbenc ctorDescriptor: new SyncDescriptor(DefaultBrowseMcpServersView, [{}]), - when: ContextKeyExpr.and(DefaultViewsContext, HasInstalledMcpServersContext.toNegated(), ChatContextKeys.Setup.hidden.negate(), McpServersGalleryStatusContext.isEqualTo(McpGalleryManifestStatus.Available), ContextKeyExpr.or(ContextKeyDefinedExpr.create(`config.${mcpGalleryServiceUrlConfig}`), ProductQualityContext.notEqualsTo('stable'), ContextKeyDefinedExpr.create(`config.${mcpGalleryServiceEnablementConfig}`))), + when: ContextKeyExpr.and(DefaultViewsContext, HasInstalledMcpServersContext.toNegated(), ContextKeyExpr.has('config.chat.disableAIFeatures').negate(), ChatContextKeys.Setup.hidden.negate(), McpServersGalleryStatusContext.isEqualTo(McpGalleryManifestStatus.Available), ContextKeyExpr.or(ContextKeyDefinedExpr.create(`config.${mcpGalleryServiceUrlConfig}`), ProductQualityContext.notEqualsTo('stable'), ContextKeyDefinedExpr.create(`config.${mcpGalleryServiceEnablementConfig}`))), weight: 40, @@ -569,3 +569,3 @@ export class McpServersViewsContribution extends Disposable implements IWorkbenc ctorDescriptor: new SyncDescriptor(DefaultBrowseMcpServersView, [{ showWelcome: true }]), - when: ContextKeyExpr.and(DefaultViewsContext, HasInstalledMcpServersContext.toNegated(), ChatContextKeys.Setup.hidden.negate(), McpServersGalleryStatusContext.isEqualTo(McpGalleryManifestStatus.Available), ContextKeyDefinedExpr.create(`config.${mcpGalleryServiceUrlConfig}`).negate(), ProductQualityContext.isEqualTo('stable'), ContextKeyDefinedExpr.create(`config.${mcpGalleryServiceEnablementConfig}`).negate()), + when: ContextKeyExpr.and(DefaultViewsContext, HasInstalledMcpServersContext.toNegated(), ContextKeyExpr.has('config.chat.disableAIFeatures').negate(), ChatContextKeys.Setup.hidden.negate(), McpServersGalleryStatusContext.isEqualTo(McpGalleryManifestStatus.Available), ContextKeyDefinedExpr.create(`config.${mcpGalleryServiceUrlConfig}`).negate(), ProductQualityContext.isEqualTo('stable'), ContextKeyDefinedExpr.create(`config.${mcpGalleryServiceEnablementConfig}`).negate()), weight: 40, diff --git a/src/vs/workbench/contrib/scm/browser/scm.contribution.ts b/src/vs/workbench/contrib/scm/browser/scm.contribution.ts index 8f2ea73..429e28f 100644 --- a/src/vs/workbench/contrib/scm/browser/scm.contribution.ts +++ b/src/vs/workbench/contrib/scm/browser/scm.contribution.ts @@ -705,3 +705,3 @@ registerAction2(class extends Action2 { ChatContextKeys.Setup.disabled.negate(), - ChatContextKeys.Setup.installed.negate(), + ContextKeyExpr.has('config.chat.disableAIFeatures').negate(), ContextKeyExpr.in(ResourceContextKey.Resource.key, 'git.mergeChanges'), diff --git a/src/vs/workbench/contrib/scm/browser/scmInput.ts b/src/vs/workbench/contrib/scm/browser/scmInput.ts index a35d479..da5a449 100644 --- a/src/vs/workbench/contrib/scm/browser/scmInput.ts +++ b/src/vs/workbench/contrib/scm/browser/scmInput.ts @@ -850,2 +850,3 @@ registerAction2(class extends Action2 { ChatContextKeys.Setup.disabled.negate(), + ContextKeyExpr.has('config.chat.disableAIFeatures').negate(), ChatContextKeys.Setup.installed.negate(),