disable-copilot.patch 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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 d5aa998..a7e4d57 100644
  3. --- a/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts
  4. +++ b/src/vs/workbench/contrib/chat/browser/actions/chatActions.ts
  5. @@ -183,3 +183,4 @@ abstract class OpenChatGlobalAction extends Action2 {
  6. ChatContextKeys.Setup.hidden.negate(),
  7. - ChatContextKeys.Setup.disabled.negate()
  8. + ChatContextKeys.Setup.disabled.negate(),
  9. + ChatContextKeys.Setup.installed
  10. )
  11. @@ -1668,3 +1669,4 @@ MenuRegistry.appendMenuItem(MenuId.CommandCenter, {
  12. ChatContextKeys.Setup.hidden.negate(),
  13. - ChatContextKeys.Setup.disabled.negate()
  14. + ChatContextKeys.Setup.disabled.negate(),
  15. + ChatContextKeys.Setup.installed
  16. ),
  17. @@ -1685,3 +1687,4 @@ MenuRegistry.appendMenuItem(MenuId.TitleBar, {
  18. ChatContextKeys.Setup.hidden.negate(),
  19. - ChatContextKeys.Setup.disabled.negate()
  20. + ChatContextKeys.Setup.disabled.negate(),
  21. + ChatContextKeys.Setup.installed
  22. ),
  23. @@ -1702,3 +1705,4 @@ registerAction2(class ToggleCopilotControl extends ToggleTitleBarConfigAction {
  24. ChatContextKeys.Setup.hidden.negate(),
  25. - ChatContextKeys.Setup.disabled.negate()
  26. + ChatContextKeys.Setup.disabled.negate(),
  27. + ChatContextKeys.Setup.installed
  28. ),
  29. @@ -1843,3 +1847,4 @@ MenuRegistry.appendMenuItem(MenuId.EditorContext, {
  30. ChatContextKeys.Setup.hidden.negate(),
  31. - ChatContextKeys.Setup.disabled.negate()
  32. + ChatContextKeys.Setup.disabled.negate(),
  33. + ChatContextKeys.Setup.installed
  34. )
  35. @@ -1876,3 +1881,3 @@ MenuRegistry.appendMenuItem(MenuId.EditorContext, {
  36. ChatContextKeys.Setup.disabled.negate(),
  37. - ChatContextKeys.Setup.installed.negate(),
  38. + ChatContextKeys.Setup.installed,
  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 dbd2125..bceed38 100644
  42. --- a/src/vs/workbench/contrib/chat/browser/chat.contribution.ts
  43. +++ b/src/vs/workbench/contrib/chat/browser/chat.contribution.ts
  44. @@ -696,3 +696,3 @@ configurationRegistry.registerConfiguration({
  45. description: nls.localize('chat.disableAIFeatures', "Disable and hide built-in AI features provided by GitHub Copilot, including chat, code completions and next edit suggestions."),
  46. - default: false,
  47. + default: true,
  48. scope: ConfigurationScope.WINDOW
  49. diff --git a/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.ts b/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.ts
  50. index 391a4de..a1489b2 100644
  51. --- a/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.ts
  52. +++ b/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.ts
  53. @@ -67,9 +67,8 @@ const chatViewDescriptor: IViewDescriptor[] = [{
  54. ctorDescriptor: new SyncDescriptor(ChatViewPane, [{ location: ChatAgentLocation.Chat }]),
  55. - when: ContextKeyExpr.or(
  56. - ContextKeyExpr.or(
  57. - ChatContextKeys.Setup.hidden,
  58. - ChatContextKeys.Setup.disabled
  59. - )?.negate(),
  60. + when: ContextKeyExpr.and(
  61. + ChatContextKeys.Setup.installed,
  62. + ChatContextKeys.Setup.disabled.negate(),
  63. + ChatContextKeys.Setup.hidden.negate(),
  64. ChatContextKeys.panelParticipantRegistered,
  65. - ChatContextKeys.extensionInvalid
  66. + ChatContextKeys.extensionInvalid.negate()
  67. )
  68. diff --git a/src/vs/workbench/contrib/chat/browser/chatSetup.ts b/src/vs/workbench/contrib/chat/browser/chatSetup.ts
  69. index 4325d48..de10415 100644
  70. --- a/src/vs/workbench/contrib/chat/browser/chatSetup.ts
  71. +++ b/src/vs/workbench/contrib/chat/browser/chatSetup.ts
  72. @@ -953,7 +953,9 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
  73. f1: true,
  74. - precondition: ContextKeyExpr.or(
  75. - ChatContextKeys.Setup.hidden,
  76. - ChatContextKeys.Setup.disabled,
  77. - ChatContextKeys.Setup.untrusted,
  78. - ChatContextKeys.Setup.installed.negate(),
  79. + precondition: ContextKeyExpr.and(
  80. + ContextKeyExpr.or(
  81. + ChatContextKeys.Setup.hidden,
  82. + ChatContextKeys.Setup.disabled,
  83. + ChatContextKeys.Setup.untrusted,
  84. + ),
  85. + ChatContextKeys.Setup.installed,
  86. ChatContextKeys.Entitlement.canSignUp
  87. @@ -1069,3 +1071,3 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
  88. ChatContextKeys.Setup.hidden.negate(),
  89. - ChatContextKeys.Setup.installed.negate(),
  90. + ChatContextKeys.Setup.installed,
  91. ChatContextKeys.Entitlement.signedOut
  92. @@ -1096,2 +1098,3 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
  93. ChatContextKeys.Setup.hidden.negate(),
  94. + ChatContextKeys.Setup.installed,
  95. ContextKeyExpr.or(
  96. @@ -1152,2 +1155,3 @@ export class ChatSetupContribution extends Disposable implements IWorkbenchContr
  97. ChatContextKeys.Setup.hidden.negate(),
  98. + ChatContextKeys.Setup.installed,
  99. ContextKeyExpr.or(
  100. @@ -1350,3 +1354,3 @@ export class ChatTeardownContribution extends Disposable implements IWorkbenchCo
  101. ChatContextKeys.Setup.hidden.negate(),
  102. - ChatContextKeys.Setup.installed.negate()
  103. + ChatContextKeys.Setup.installed
  104. ),
  105. @@ -1356,3 +1360,3 @@ export class ChatTeardownContribution extends Disposable implements IWorkbenchCo
  106. order: 1,
  107. - when: ChatContextKeys.Setup.installed.negate()
  108. + when: ChatContextKeys.Setup.installed
  109. }
  110. diff --git a/src/vs/workbench/contrib/chat/browser/chatStatus.ts b/src/vs/workbench/contrib/chat/browser/chatStatus.ts
  111. index 05f6f0e..7fe62fd 100644
  112. --- a/src/vs/workbench/contrib/chat/browser/chatStatus.ts
  113. +++ b/src/vs/workbench/contrib/chat/browser/chatStatus.ts
  114. @@ -132,2 +132,7 @@ export class ChatStatusBarEntry extends Disposable implements IWorkbenchContribu
  115. + const context = chatEntitlementService.context?.value;
  116. + if (!context) {
  117. + return; // disabled
  118. + }
  119. +
  120. this.update();
  121. diff --git a/src/vs/workbench/contrib/chat/common/chatContextKeys.ts b/src/vs/workbench/contrib/chat/common/chatContextKeys.ts
  122. index 4877407..fa134a7 100644
  123. --- a/src/vs/workbench/contrib/chat/common/chatContextKeys.ts
  124. +++ b/src/vs/workbench/contrib/chat/common/chatContextKeys.ts
  125. @@ -104,4 +104,4 @@ export namespace ChatContextKeyExprs {
  126. */
  127. - export const chatSetupTriggerContext = ContextKeyExpr.or(
  128. - ChatContextKeys.Setup.installed.negate(),
  129. + export const chatSetupTriggerContext = ContextKeyExpr.and(
  130. + ChatContextKeys.Setup.installed,
  131. ChatContextKeys.Entitlement.canSignUp
  132. diff --git a/src/vs/workbench/contrib/mcp/browser/mcpServersView.ts b/src/vs/workbench/contrib/mcp/browser/mcpServersView.ts
  133. index 5a12c9d..f62c111 100644
  134. --- a/src/vs/workbench/contrib/mcp/browser/mcpServersView.ts
  135. +++ b/src/vs/workbench/contrib/mcp/browser/mcpServersView.ts
  136. @@ -530,3 +530,3 @@ export class McpServersViewsContribution extends Disposable implements IWorkbenc
  137. ctorDescriptor: new SyncDescriptor(DefaultBrowseMcpServersView, [{}]),
  138. - 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}`))),
  139. + 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}`))),
  140. weight: 40,
  141. @@ -545,3 +545,3 @@ export class McpServersViewsContribution extends Disposable implements IWorkbenc
  142. ctorDescriptor: new SyncDescriptor(DefaultBrowseMcpServersView, [{ showWelcome: true }]),
  143. - 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()),
  144. + 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()),
  145. weight: 40,
  146. diff --git a/src/vs/workbench/contrib/scm/browser/scm.contribution.ts b/src/vs/workbench/contrib/scm/browser/scm.contribution.ts
  147. index a2d4dc9..a15ac03 100644
  148. --- a/src/vs/workbench/contrib/scm/browser/scm.contribution.ts
  149. +++ b/src/vs/workbench/contrib/scm/browser/scm.contribution.ts
  150. @@ -659,3 +659,3 @@ registerAction2(class extends Action2 {
  151. ChatContextKeys.Setup.disabled.negate(),
  152. - ChatContextKeys.Setup.installed.negate(),
  153. + ChatContextKeys.Setup.installed,
  154. ContextKeyExpr.equals('git.activeResourceHasMergeConflicts', true)
  155. diff --git a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts
  156. index d32554a..9257c26 100644
  157. --- a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts
  158. +++ b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts
  159. @@ -1346,3 +1346,3 @@ registerAction2(class extends Action2 {
  160. ChatContextKeys.Setup.disabled.negate(),
  161. - ChatContextKeys.Setup.installed.negate(),
  162. + ChatContextKeys.Setup.installed,
  163. ContextKeyExpr.equals('scmProvider', 'git')