mirror of
https://github.com/VSCodium/vscodium.git
synced 2026-04-11 16:27:18 +10:00
fix(copilot): use disableAIFeatures setting instead of installed property (#2567)
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
diff --git a/src/vs/workbench/contrib/chat/browser/chat.contribution.ts b/src/vs/workbench/contrib/chat/browser/chat.contribution.ts
|
||||
index 549cfc6..9632509 100644
|
||||
--- a/src/vs/workbench/contrib/chat/browser/chat.contribution.ts
|
||||
+++ b/src/vs/workbench/contrib/chat/browser/chat.contribution.ts
|
||||
@@ -171,3 +171,3 @@ configurationRegistry.registerConfiguration({
|
||||
markdownDescription: nls.localize('chat.commandCenter.enabled', "Controls whether the command center shows a menu for actions to control chat (requires {0}).", '`#window.commandCenter#`'),
|
||||
- default: true
|
||||
+ default: false
|
||||
},
|
||||
@@ -1,53 +1,63 @@
|
||||
diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts b/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts
|
||||
index d5aa998..a7e4d57 100644
|
||||
index d5aa998..ea7d567 100644
|
||||
--- a/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts
|
||||
+++ b/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts
|
||||
@@ -183,3 +183,4 @@ abstract class OpenChatGlobalAction extends Action2 {
|
||||
ChatContextKeys.Setup.hidden.negate(),
|
||||
- ChatContextKeys.Setup.disabled.negate()
|
||||
+ ChatContextKeys.Setup.disabled.negate(),
|
||||
+ ChatContextKeys.Setup.installed
|
||||
+ ContextKeyExpr.has('config.chat.disableAIFeatures').negate()
|
||||
)
|
||||
@@ -1458,3 +1459,3 @@ export function registerChatActions() {
|
||||
precondition: ContextKeyExpr.and(
|
||||
- ChatContextKeys.Setup.installed,
|
||||
+ ContextKeyExpr.has('config.chat.disableAIFeatures').negate(),
|
||||
ChatContextKeys.Setup.disabled.negate(),
|
||||
@@ -1668,3 +1669,4 @@ MenuRegistry.appendMenuItem(MenuId.CommandCenter, {
|
||||
ChatContextKeys.Setup.hidden.negate(),
|
||||
- ChatContextKeys.Setup.disabled.negate()
|
||||
+ ChatContextKeys.Setup.disabled.negate(),
|
||||
+ ChatContextKeys.Setup.installed
|
||||
+ ContextKeyExpr.has('config.chat.disableAIFeatures').negate()
|
||||
),
|
||||
@@ -1685,3 +1687,4 @@ MenuRegistry.appendMenuItem(MenuId.TitleBar, {
|
||||
ChatContextKeys.Setup.hidden.negate(),
|
||||
- ChatContextKeys.Setup.disabled.negate()
|
||||
+ ChatContextKeys.Setup.disabled.negate(),
|
||||
+ ChatContextKeys.Setup.installed
|
||||
+ ContextKeyExpr.has('config.chat.disableAIFeatures').negate()
|
||||
),
|
||||
@@ -1702,3 +1705,4 @@ registerAction2(class ToggleCopilotControl extends ToggleTitleBarConfigAction {
|
||||
ChatContextKeys.Setup.hidden.negate(),
|
||||
- ChatContextKeys.Setup.disabled.negate()
|
||||
+ ChatContextKeys.Setup.disabled.negate(),
|
||||
+ ChatContextKeys.Setup.installed
|
||||
+ ContextKeyExpr.has('config.chat.disableAIFeatures').negate()
|
||||
),
|
||||
@@ -1843,3 +1847,4 @@ MenuRegistry.appendMenuItem(MenuId.EditorContext, {
|
||||
ChatContextKeys.Setup.hidden.negate(),
|
||||
- ChatContextKeys.Setup.disabled.negate()
|
||||
+ ChatContextKeys.Setup.disabled.negate(),
|
||||
+ ChatContextKeys.Setup.installed
|
||||
+ ContextKeyExpr.has('config.chat.disableAIFeatures').negate()
|
||||
)
|
||||
@@ -1876,3 +1881,3 @@ MenuRegistry.appendMenuItem(MenuId.EditorContext, {
|
||||
ChatContextKeys.Setup.disabled.negate(),
|
||||
- ChatContextKeys.Setup.installed.negate(),
|
||||
+ ChatContextKeys.Setup.installed,
|
||||
+ 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 dbd2125..bceed38 100644
|
||||
index dbd2125..2f36f7b 100644
|
||||
--- a/src/vs/workbench/contrib/chat/browser/chat.contribution.ts
|
||||
+++ b/src/vs/workbench/contrib/chat/browser/chat.contribution.ts
|
||||
@@ -174,3 +174,3 @@ configurationRegistry.registerConfiguration({
|
||||
markdownDescription: nls.localize('chat.commandCenter.enabled', "Controls whether the command center shows a menu for actions to control chat (requires {0}).", '`#window.commandCenter#`'),
|
||||
- default: true
|
||||
+ default: false
|
||||
},
|
||||
@@ -696,3 +696,3 @@ configurationRegistry.registerConfiguration({
|
||||
description: nls.localize('chat.disableAIFeatures', "Disable and hide built-in AI features provided by GitHub Copilot, including chat, code completions and next edit 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 391a4de..a1489b2 100644
|
||||
index 391a4de..995590c 100644
|
||||
--- a/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.ts
|
||||
+++ b/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.ts
|
||||
@@ -67,9 +67,8 @@ const chatViewDescriptor: IViewDescriptor[] = [{
|
||||
@@ -58,7 +68,7 @@ index 391a4de..a1489b2 100644
|
||||
- ChatContextKeys.Setup.disabled
|
||||
- )?.negate(),
|
||||
+ when: ContextKeyExpr.and(
|
||||
+ ChatContextKeys.Setup.installed,
|
||||
+ ContextKeyExpr.has('config.chat.disableAIFeatures').negate(),
|
||||
+ ChatContextKeys.Setup.disabled.negate(),
|
||||
+ ChatContextKeys.Setup.hidden.negate(),
|
||||
ChatContextKeys.panelParticipantRegistered,
|
||||
@@ -66,7 +76,7 @@ index 391a4de..a1489b2 100644
|
||||
+ ChatContextKeys.extensionInvalid.negate()
|
||||
)
|
||||
diff --git a/src/vs/workbench/contrib/chat/browser/chatSetup.ts b/src/vs/workbench/contrib/chat/browser/chatSetup.ts
|
||||
index 4325d48..de10415 100644
|
||||
index 4325d48..53edd2c 100644
|
||||
--- a/src/vs/workbench/contrib/chat/browser/chatSetup.ts
|
||||
+++ b/src/vs/workbench/contrib/chat/browser/chatSetup.ts
|
||||
@@ -953,7 +953,9 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
|
||||
@@ -82,45 +92,53 @@ index 4325d48..de10415 100644
|
||||
+ ChatContextKeys.Setup.disabled,
|
||||
+ ChatContextKeys.Setup.untrusted,
|
||||
+ ),
|
||||
+ ChatContextKeys.Setup.installed,
|
||||
+ ContextKeyExpr.has('config.chat.disableAIFeatures').negate(),
|
||||
ChatContextKeys.Entitlement.canSignUp
|
||||
@@ -1069,3 +1071,3 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
|
||||
ChatContextKeys.Setup.hidden.negate(),
|
||||
- ChatContextKeys.Setup.installed.negate(),
|
||||
+ ChatContextKeys.Setup.installed,
|
||||
+ ContextKeyExpr.has('config.chat.disableAIFeatures').negate(),
|
||||
ChatContextKeys.Entitlement.signedOut
|
||||
@@ -1096,2 +1098,3 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
|
||||
ChatContextKeys.Setup.hidden.negate(),
|
||||
+ ChatContextKeys.Setup.installed,
|
||||
+ ContextKeyExpr.has('config.chat.disableAIFeatures').negate(),
|
||||
ContextKeyExpr.or(
|
||||
@@ -1152,2 +1155,3 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
|
||||
ChatContextKeys.Setup.hidden.negate(),
|
||||
+ ChatContextKeys.Setup.installed,
|
||||
+ ContextKeyExpr.has('config.chat.disableAIFeatures').negate(),
|
||||
ContextKeyExpr.or(
|
||||
@@ -1350,3 +1354,3 @@ export class ChatTeardownContribution extends Disposable implements IWorkbenchCo
|
||||
ChatContextKeys.Setup.hidden.negate(),
|
||||
- ChatContextKeys.Setup.installed.negate()
|
||||
+ ChatContextKeys.Setup.installed
|
||||
+ ContextKeyExpr.has('config.chat.disableAIFeatures').negate()
|
||||
),
|
||||
@@ -1356,3 +1360,3 @@ export class ChatTeardownContribution extends Disposable implements IWorkbenchCo
|
||||
order: 1,
|
||||
- when: ChatContextKeys.Setup.installed.negate()
|
||||
+ when: ChatContextKeys.Setup.installed
|
||||
+ when: ContextKeyExpr.has('config.chat.disableAIFeatures').negate()
|
||||
}
|
||||
diff --git a/src/vs/workbench/contrib/chat/browser/chatStatus.ts b/src/vs/workbench/contrib/chat/browser/chatStatus.ts
|
||||
index 05f6f0e..7fe62fd 100644
|
||||
index 05f6f0e..5f7a988 100644
|
||||
--- a/src/vs/workbench/contrib/chat/browser/chatStatus.ts
|
||||
+++ b/src/vs/workbench/contrib/chat/browser/chatStatus.ts
|
||||
@@ -132,2 +132,7 @@ export class ChatStatusBarEntry extends Disposable implements IWorkbenchContribu
|
||||
@@ -48,2 +48,3 @@ import { MarkdownRenderer } from '../../../../editor/browser/widget/markdownRend
|
||||
import { MarkdownString } from '../../../../base/common/htmlContent.js';
|
||||
+import { ContextKeyExpr, IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
|
||||
|
||||
+ const context = chatEntitlementService.context?.value;
|
||||
+ if (!context) {
|
||||
@@ -129,2 +130,3 @@ export class ChatStatusBarEntry extends Disposable implements IWorkbenchContribu
|
||||
@IChatSessionsService private readonly chatSessionsService: IChatSessionsService,
|
||||
+ @IContextKeyService private readonly contextKeyService: IContextKeyService,
|
||||
) {
|
||||
@@ -132,2 +134,7 @@ export class ChatStatusBarEntry extends Disposable implements IWorkbenchContribu
|
||||
|
||||
+ const rule = ContextKeyExpr.has('config.chat.disableAIFeatures');
|
||||
+ if (this.contextKeyService.contextMatchesRules(rule)) {
|
||||
+ return; // disabled
|
||||
+ }
|
||||
+
|
||||
this.update();
|
||||
diff --git a/src/vs/workbench/contrib/chat/common/chatContextKeys.ts b/src/vs/workbench/contrib/chat/common/chatContextKeys.ts
|
||||
index 4877407..fa134a7 100644
|
||||
index 4877407..d11d315 100644
|
||||
--- a/src/vs/workbench/contrib/chat/common/chatContextKeys.ts
|
||||
+++ b/src/vs/workbench/contrib/chat/common/chatContextKeys.ts
|
||||
@@ -104,4 +104,4 @@ export namespace ChatContextKeyExprs {
|
||||
@@ -128,37 +146,37 @@ index 4877407..fa134a7 100644
|
||||
- export const chatSetupTriggerContext = ContextKeyExpr.or(
|
||||
- ChatContextKeys.Setup.installed.negate(),
|
||||
+ export const chatSetupTriggerContext = ContextKeyExpr.and(
|
||||
+ ChatContextKeys.Setup.installed,
|
||||
+ ContextKeyExpr.has('config.chat.disableAIFeatures').negate(),
|
||||
ChatContextKeys.Entitlement.canSignUp
|
||||
diff --git a/src/vs/workbench/contrib/mcp/browser/mcpServersView.ts b/src/vs/workbench/contrib/mcp/browser/mcpServersView.ts
|
||||
index 5a12c9d..f62c111 100644
|
||||
index 5a12c9d..3e1f23e 100644
|
||||
--- a/src/vs/workbench/contrib/mcp/browser/mcpServersView.ts
|
||||
+++ b/src/vs/workbench/contrib/mcp/browser/mcpServersView.ts
|
||||
@@ -530,3 +530,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(), ChatContextKeys.Setup.installed, 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,
|
||||
@@ -545,3 +545,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(), ChatContextKeys.Setup.installed, 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 a2d4dc9..a15ac03 100644
|
||||
index a2d4dc9..3f7a511 100644
|
||||
--- a/src/vs/workbench/contrib/scm/browser/scm.contribution.ts
|
||||
+++ b/src/vs/workbench/contrib/scm/browser/scm.contribution.ts
|
||||
@@ -659,3 +659,3 @@ registerAction2(class extends Action2 {
|
||||
ChatContextKeys.Setup.disabled.negate(),
|
||||
- ChatContextKeys.Setup.installed.negate(),
|
||||
+ ChatContextKeys.Setup.installed,
|
||||
+ ContextKeyExpr.has('config.chat.disableAIFeatures').negate(),
|
||||
ContextKeyExpr.equals('git.activeResourceHasMergeConflicts', true)
|
||||
diff --git a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts
|
||||
index d32554a..9257c26 100644
|
||||
index d32554a..01d3cf6 100644
|
||||
--- a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts
|
||||
+++ b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts
|
||||
@@ -1346,3 +1346,3 @@ registerAction2(class extends Action2 {
|
||||
ChatContextKeys.Setup.disabled.negate(),
|
||||
- ChatContextKeys.Setup.installed.negate(),
|
||||
+ ChatContextKeys.Setup.installed,
|
||||
+ ContextKeyExpr.has('config.chat.disableAIFeatures').negate(),
|
||||
ContextKeyExpr.equals('scmProvider', 'git')
|
||||
|
||||
Reference in New Issue
Block a user