3
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
4
*--------------------------------------------------------------------------------------------*/
5
5
6
+ import { Action } from 'vs/base/common/actions' ;
6
7
import { isNonEmptyArray } from 'vs/base/common/arrays' ;
7
8
import { Codicon } from 'vs/base/common/codicons' ;
8
9
import { Disposable , DisposableMap , DisposableStore , IDisposable , toDisposable } from 'vs/base/common/lifecycle' ;
9
10
import * as strings from 'vs/base/common/strings' ;
10
11
import { localize , localize2 } from 'vs/nls' ;
12
+ import { ICommandService } from 'vs/platform/commands/common/commands' ;
11
13
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions' ;
12
14
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors' ;
13
15
import { ILogService } from 'vs/platform/log/common/log' ;
16
+ import { INotificationService , Severity } from 'vs/platform/notification/common/notification' ;
14
17
import { Registry } from 'vs/platform/registry/common/platform' ;
15
18
import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer' ;
16
19
import { IWorkbenchContribution } from 'vs/workbench/common/contributions' ;
@@ -19,6 +22,7 @@ import { CHAT_VIEW_ID } from 'vs/workbench/contrib/chat/browser/chat';
19
22
import { CHAT_SIDEBAR_PANEL_ID , ChatViewPane } from 'vs/workbench/contrib/chat/browser/chatViewPane' ;
20
23
import { ChatAgentLocation , IChatAgentData , IChatAgentService } from 'vs/workbench/contrib/chat/common/chatAgents' ;
21
24
import { IRawChatParticipantContribution } from 'vs/workbench/contrib/chat/common/chatParticipantContribTypes' ;
25
+ import { IExtensionsWorkbenchService } from 'vs/workbench/contrib/extensions/common/extensions' ;
22
26
import { isProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions' ;
23
27
import * as extensionsRegistry from 'vs/workbench/services/extensions/common/extensionsRegistry' ;
24
28
@@ -104,6 +108,35 @@ const chatParticipantExtensionPoint = extensionsRegistry.ExtensionsRegistry.regi
104
108
} ,
105
109
} ) ;
106
110
111
+ export class ChatCompatibilityNotifier implements IWorkbenchContribution {
112
+ static readonly ID = 'workbench.contrib.chatCompatNotifier' ;
113
+
114
+ constructor (
115
+ @IExtensionsWorkbenchService extensionsWorkbenchService : IExtensionsWorkbenchService ,
116
+ @INotificationService notificationService : INotificationService ,
117
+ @ICommandService commandService : ICommandService
118
+ ) {
119
+ // It may be better to have some generic UI for this, for any extension that is incompatible,
120
+ // but this is only enabled for Copilot Chat now and it needs to be obvious.
121
+ extensionsWorkbenchService . queryLocal ( ) . then ( exts => {
122
+ const chat = exts . find ( ext => ext . identifier . id === 'github.copilot-chat' ) ;
123
+ if ( chat ?. local ?. validations . some ( v => v [ 0 ] === Severity . Error ) ) {
124
+ notificationService . notify ( {
125
+ severity : Severity . Error ,
126
+ message : localize ( 'chatFailErrorMessage' , "Chat failed to load. Please ensure that the GitHub Copilot Chat extension is up to date." ) ,
127
+ actions : {
128
+ primary : [
129
+ new Action ( 'showExtension' , localize ( 'action.showExtension' , "Show Extension" ) , undefined , true , ( ) => {
130
+ return commandService . executeCommand ( 'workbench.extensions.action.showExtensionsWithIds' , [ 'GitHub.copilot-chat' ] ) ;
131
+ } )
132
+ ]
133
+ }
134
+ } ) ;
135
+ }
136
+ } ) ;
137
+ }
138
+ }
139
+
107
140
export class ChatExtensionPointHandler implements IWorkbenchContribution {
108
141
109
142
static readonly ID = 'workbench.contrib.chatExtensionPointHandler' ;
0 commit comments