disable-copilot.patch 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts b/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts
  2. index 43eea51..4ce6918 100644
  3. --- a/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts
  4. +++ b/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts
  5. @@ -181,3 +181,4 @@ abstract class OpenChatGlobalAction extends Action2 {
  6. ChatContextKeys.Setup.hidden.negate(),
  7. - ChatContextKeys.Setup.disabled.negate()
  8. + ChatContextKeys.Setup.disabled.negate(),
  9. + ContextKeyExpr.has('config.chat.disableAIFeatures').negate()
  10. )
  11. @@ -1395,3 +1396,3 @@ export function registerChatActions() {
  12. precondition: ContextKeyExpr.and(
  13. - ChatContextKeys.Setup.installed,
  14. + ContextKeyExpr.has('config.chat.disableAIFeatures').negate(),
  15. ChatContextKeys.Setup.disabled.negate(),
  16. @@ -1608,3 +1609,4 @@ MenuRegistry.appendMenuItem(MenuId.CommandCenter, {
  17. ChatContextKeys.Setup.hidden.negate(),
  18. - ChatContextKeys.Setup.disabled.negate()
  19. + ChatContextKeys.Setup.disabled.negate(),
  20. + ContextKeyExpr.has('config.chat.disableAIFeatures').negate()
  21. ),
  22. @@ -1625,3 +1627,4 @@ MenuRegistry.appendMenuItem(MenuId.TitleBar, {
  23. ChatContextKeys.Setup.hidden.negate(),
  24. - ChatContextKeys.Setup.disabled.negate()
  25. + ChatContextKeys.Setup.disabled.negate(),
  26. + ContextKeyExpr.has('config.chat.disableAIFeatures').negate()
  27. ),
  28. @@ -1642,3 +1645,4 @@ registerAction2(class ToggleCopilotControl extends ToggleTitleBarConfigAction {
  29. ChatContextKeys.Setup.hidden.negate(),
  30. - ChatContextKeys.Setup.disabled.negate()
  31. + ChatContextKeys.Setup.disabled.negate(),
  32. + ContextKeyExpr.has('config.chat.disableAIFeatures').negate()
  33. ),
  34. @@ -1779,3 +1783,4 @@ MenuRegistry.appendMenuItem(MenuId.EditorContext, {
  35. ChatContextKeys.Setup.hidden.negate(),
  36. - ChatContextKeys.Setup.disabled.negate()
  37. + ChatContextKeys.Setup.disabled.negate(),
  38. + ContextKeyExpr.has('config.chat.disableAIFeatures').negate()
  39. )
  40. diff --git a/src/vs/workbench/contrib/chat/browser/chat.contribution.ts b/src/vs/workbench/contrib/chat/browser/chat.contribution.ts
  41. index ee0b4a4..c6243b8 100644
  42. --- a/src/vs/workbench/contrib/chat/browser/chat.contribution.ts
  43. +++ b/src/vs/workbench/contrib/chat/browser/chat.contribution.ts
  44. @@ -187,3 +187,3 @@ configurationRegistry.registerConfiguration({
  45. markdownDescription: nls.localize('chat.commandCenter.enabled', "Controls whether the command center shows a menu for actions to control chat (requires {0}).", '`#window.commandCenter#`'),
  46. - default: true
  47. + default: false
  48. },
  49. @@ -801,3 +801,3 @@ configurationRegistry.registerConfiguration({
  50. description: nls.localize('chat.disableAIFeatures', "Disable and hide built-in AI features provided by GitHub Copilot, including chat and inline suggestions."),
  51. - default: false,
  52. + default: true,
  53. scope: ConfigurationScope.WINDOW
  54. diff --git a/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.ts b/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.ts
  55. index 9573667..f71e066 100644
  56. --- a/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.ts
  57. +++ b/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.ts
  58. @@ -67,10 +67,9 @@ const chatViewDescriptor: IViewDescriptor = {
  59. ctorDescriptor: new SyncDescriptor(ChatViewPane),
  60. - when: ContextKeyExpr.or(
  61. - ContextKeyExpr.or(
  62. - ChatContextKeys.Setup.hidden,
  63. - ChatContextKeys.Setup.disabled
  64. - )?.negate(),
  65. - ChatContextKeys.panelParticipantRegistered,
  66. - ChatContextKeys.extensionInvalid
  67. - )
  68. + when: ContextKeyExpr.and(
  69. + ContextKeyExpr.has('config.chat.disableAIFeatures').negate(),
  70. + ChatContextKeys.Setup.disabled.negate(),
  71. + ChatContextKeys.Setup.hidden.negate(),
  72. + ChatContextKeys.panelParticipantRegistered,
  73. + ChatContextKeys.extensionInvalid.negate()
  74. + )
  75. };
  76. diff --git a/src/vs/workbench/contrib/chat/common/chatContextKeys.ts b/src/vs/workbench/contrib/chat/common/chatContextKeys.ts
  77. index 09aef7e..daf6437 100644
  78. --- a/src/vs/workbench/contrib/chat/common/chatContextKeys.ts
  79. +++ b/src/vs/workbench/contrib/chat/common/chatContextKeys.ts
  80. @@ -113,4 +113,4 @@ export namespace ChatContextKeyExprs {
  81. */
  82. - export const chatSetupTriggerContext = ContextKeyExpr.or(
  83. - ChatContextKeys.Setup.installed.negate(),
  84. + export const chatSetupTriggerContext = ContextKeyExpr.and(
  85. + ContextKeyExpr.has('config.chat.disableAIFeatures').negate(),
  86. ChatContextKeys.Entitlement.canSignUp
  87. diff --git a/src/vs/workbench/contrib/mcp/browser/mcpServersView.ts b/src/vs/workbench/contrib/mcp/browser/mcpServersView.ts
  88. index d8ddc37..f48fd86 100644
  89. --- a/src/vs/workbench/contrib/mcp/browser/mcpServersView.ts
  90. +++ b/src/vs/workbench/contrib/mcp/browser/mcpServersView.ts
  91. @@ -540,3 +540,3 @@ export class McpServersViewsContribution extends Disposable implements IWorkbenc
  92. ctorDescriptor: new SyncDescriptor(DefaultBrowseMcpServersView, [{}]),
  93. - 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}`))),
  94. + 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}`))),
  95. weight: 40,
  96. @@ -555,3 +555,3 @@ export class McpServersViewsContribution extends Disposable implements IWorkbenc
  97. ctorDescriptor: new SyncDescriptor(DefaultBrowseMcpServersView, [{ showWelcome: true }]),
  98. - 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()),
  99. + 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()),
  100. weight: 40,
  101. diff --git a/src/vs/workbench/contrib/scm/browser/scm.contribution.ts b/src/vs/workbench/contrib/scm/browser/scm.contribution.ts
  102. index fe12782..06b1b76 100644
  103. --- a/src/vs/workbench/contrib/scm/browser/scm.contribution.ts
  104. +++ b/src/vs/workbench/contrib/scm/browser/scm.contribution.ts
  105. @@ -685,3 +685,3 @@ registerAction2(class extends Action2 {
  106. ChatContextKeys.Setup.disabled.negate(),
  107. - ChatContextKeys.Setup.installed.negate(),
  108. + ContextKeyExpr.has('config.chat.disableAIFeatures').negate(),
  109. ContextKeyExpr.in(ResourceContextKey.Resource.key, 'git.mergeChanges'),
  110. diff --git a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts
  111. index 4260a28..6ac55b6 100644
  112. --- a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts
  113. +++ b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts
  114. @@ -1383,3 +1383,3 @@ registerAction2(class extends Action2 {
  115. ChatContextKeys.Setup.disabled.negate(),
  116. - ChatContextKeys.Setup.installed.negate(),
  117. + ContextKeyExpr.has('config.chat.disableAIFeatures').negate(),
  118. ContextKeyExpr.equals('scmProvider', 'git')