-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisable-copilot.patch
More file actions
182 lines (180 loc) · 11.4 KB
/
Copy pathdisable-copilot.patch
File metadata and controls
182 lines (180 loc) · 11.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts b/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts
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(),
+ 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(),
+ 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(),
+ 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(),
+ 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(),
+ ContextKeyExpr.has('config.chat.disableAIFeatures').negate()
)
@@ -1876,3 +1881,3 @@ MenuRegistry.appendMenuItem(MenuId.EditorContext, {
ChatContextKeys.Setup.disabled.negate(),
- ChatContextKeys.Setup.installed.negate(),
+ 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..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..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[] = [{
ctorDescriptor: new SyncDescriptor(ChatViewPane, [{ location: ChatAgentLocation.Chat }]),
- when: ContextKeyExpr.or(
- ContextKeyExpr.or(
- ChatContextKeys.Setup.hidden,
- ChatContextKeys.Setup.disabled
- )?.negate(),
+ when: ContextKeyExpr.and(
+ ContextKeyExpr.has('config.chat.disableAIFeatures').negate(),
+ ChatContextKeys.Setup.disabled.negate(),
+ ChatContextKeys.Setup.hidden.negate(),
ChatContextKeys.panelParticipantRegistered,
- ChatContextKeys.extensionInvalid
+ 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..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
f1: true,
- precondition: ContextKeyExpr.or(
- ChatContextKeys.Setup.hidden,
- ChatContextKeys.Setup.disabled,
- ChatContextKeys.Setup.untrusted,
- ChatContextKeys.Setup.installed.negate(),
+ precondition: ContextKeyExpr.and(
+ ContextKeyExpr.or(
+ ChatContextKeys.Setup.hidden,
+ ChatContextKeys.Setup.disabled,
+ ChatContextKeys.Setup.untrusted,
+ ),
+ 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(),
+ ContextKeyExpr.has('config.chat.disableAIFeatures').negate(),
ChatContextKeys.Entitlement.signedOut
@@ -1096,2 +1098,3 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
ChatContextKeys.Setup.hidden.negate(),
+ ContextKeyExpr.has('config.chat.disableAIFeatures').negate(),
ContextKeyExpr.or(
@@ -1152,2 +1155,3 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
ChatContextKeys.Setup.hidden.negate(),
+ 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()
+ 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: 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..5f7a988 100644
--- a/src/vs/workbench/contrib/chat/browser/chatStatus.ts
+++ b/src/vs/workbench/contrib/chat/browser/chatStatus.ts
@@ -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';
@@ -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..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 {
*/
- export const chatSetupTriggerContext = ContextKeyExpr.or(
- ChatContextKeys.Setup.installed.negate(),
+ export const chatSetupTriggerContext = ContextKeyExpr.and(
+ 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..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(), 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(), 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..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(),
+ 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..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(),
+ ContextKeyExpr.has('config.chat.disableAIFeatures').negate(),
ContextKeyExpr.equals('scmProvider', 'git')