@@ -7,6 +7,7 @@ import * as dom from 'vs/base/browser/dom';
7
7
import { IActionViewItemOptions } from 'vs/base/browser/ui/actionbar/actionViewItems' ;
8
8
import { alert } from 'vs/base/browser/ui/aria/aria' ;
9
9
import { Button } from 'vs/base/browser/ui/button/button' ;
10
+ import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory' ;
10
11
import { renderIcon } from 'vs/base/browser/ui/iconLabel/iconLabels' ;
11
12
import { IListRenderer , IListVirtualDelegate } from 'vs/base/browser/ui/list/list' ;
12
13
import { ITreeCompressionDelegate } from 'vs/base/browser/ui/tree/asyncDataTree' ;
@@ -16,6 +17,7 @@ import { IAsyncDataSource, ITreeNode, ITreeRenderer } from 'vs/base/browser/ui/t
16
17
import { IAction } from 'vs/base/common/actions' ;
17
18
import { distinct } from 'vs/base/common/arrays' ;
18
19
import { disposableTimeout } from 'vs/base/common/async' ;
20
+ import { CancellationTokenSource } from 'vs/base/common/cancellation' ;
19
21
import { Codicon } from 'vs/base/common/codicons' ;
20
22
import { Emitter , Event } from 'vs/base/common/event' ;
21
23
import { FuzzyScore } from 'vs/base/common/filters' ;
@@ -24,13 +26,18 @@ import { Disposable, DisposableStore, IDisposable, IReference, toDisposable } fr
24
26
import { ResourceMap } from 'vs/base/common/map' ;
25
27
import { FileAccess , Schemas , matchesSomeScheme } from 'vs/base/common/network' ;
26
28
import { clamp } from 'vs/base/common/numbers' ;
29
+ import { IObservable , autorun , constObservable } from 'vs/base/common/observable' ;
27
30
import { basename } from 'vs/base/common/path' ;
28
31
import { basenameOrAuthority } from 'vs/base/common/resources' ;
29
32
import { equalsIgnoreCase } from 'vs/base/common/strings' ;
30
33
import { ThemeIcon } from 'vs/base/common/themables' ;
34
+ import { isUndefined } from 'vs/base/common/types' ;
31
35
import { URI } from 'vs/base/common/uri' ;
32
36
import { IMarkdownRenderResult , MarkdownRenderer } from 'vs/editor/browser/widget/markdownRenderer/browser/markdownRenderer' ;
33
37
import { Range } from 'vs/editor/common/core/range' ;
38
+ import { TextEdit } from 'vs/editor/common/languages' ;
39
+ import { createTextBufferFactoryFromSnapshot } from 'vs/editor/common/model/textModel' ;
40
+ import { IModelService } from 'vs/editor/common/services/model' ;
34
41
import { IResolvedTextEditorModel , ITextModelService } from 'vs/editor/common/services/resolverService' ;
35
42
import { localize } from 'vs/nls' ;
36
43
import { IMenuEntryActionViewItemOptions , MenuEntryActionViewItem , createActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem' ;
@@ -40,6 +47,7 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
40
47
import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
41
48
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey' ;
42
49
import { FileKind , FileType } from 'vs/platform/files/common/files' ;
50
+ import { IHoverService } from 'vs/platform/hover/browser/hover' ;
43
51
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
44
52
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection' ;
45
53
import { WorkbenchCompressibleAsyncDataTree , WorkbenchList } from 'vs/platform/list/browser/listService' ;
@@ -50,6 +58,7 @@ import { ColorScheme } from 'vs/platform/theme/common/theme';
50
58
import { IThemeService } from 'vs/platform/theme/common/themeService' ;
51
59
import { IResourceLabel , ResourceLabels } from 'vs/workbench/browser/labels' ;
52
60
import { ChatTreeItem , GeneratingPhrase , IChatCodeBlockInfo , IChatFileTreeInfo } from 'vs/workbench/contrib/chat/browser/chat' ;
61
+ import { ChatAgentHover } from 'vs/workbench/contrib/chat/browser/chatAgentHover' ;
53
62
import { ChatFollowups } from 'vs/workbench/contrib/chat/browser/chatFollowups' ;
54
63
import { ChatMarkdownDecorationsRenderer } from 'vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer' ;
55
64
import { ChatEditorOptions } from 'vs/workbench/contrib/chat/browser/chatOptions' ;
@@ -66,17 +75,12 @@ import { createFileIconThemableTreeContainerScope } from 'vs/workbench/contrib/f
66
75
import { IFilesConfiguration } from 'vs/workbench/contrib/files/common/files' ;
67
76
import { IMarkdownVulnerability , annotateSpecialMarkdownContent } from '../common/annotations' ;
68
77
import { CodeBlockModelCollection } from '../common/codeBlockModelCollection' ;
69
- import { IModelService } from 'vs/editor/common/services/model' ;
70
- import { createTextBufferFactoryFromSnapshot } from 'vs/editor/common/model/textModel' ;
71
- import { TextEdit } from 'vs/editor/common/languages' ;
72
78
import { IChatListItemRendererOptions } from './chat' ;
73
- import { CancellationTokenSource } from 'vs/base/common/cancellation' ;
74
- import { autorun , constObservable , IObservable } from 'vs/base/common/observable' ;
75
- import { isUndefined } from 'vs/base/common/types' ;
76
79
77
80
const $ = dom . $ ;
78
81
79
82
interface IChatListItemTemplate {
83
+ currentElement ?: ChatTreeItem ;
80
84
readonly rowContainer : HTMLElement ;
81
85
readonly titleToolbar ?: MenuWorkbenchToolBar ;
82
86
readonly avatarContainer : HTMLElement ;
@@ -148,6 +152,7 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
148
152
@ICommandService private readonly commandService : ICommandService ,
149
153
@ITextModelService private readonly textModelService : ITextModelService ,
150
154
@IModelService private readonly modelService : IModelService ,
155
+ @IHoverService private readonly hoverService : IHoverService ,
151
156
@IChatAgentNameService private readonly chatAgentNameService : IChatAgentNameService ,
152
157
) {
153
158
super ( ) ;
@@ -286,6 +291,16 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
286
291
}
287
292
} ) ) ;
288
293
}
294
+
295
+ templateDisposables . add ( this . hoverService . setupUpdatableHover ( getDefaultHoverDelegate ( 'mouse' ) , header , ( ) => {
296
+ if ( isResponseVM ( template . currentElement ) && template . currentElement . agent ) {
297
+ const hover = this . instantiationService . createInstance ( ChatAgentHover , template . currentElement . agent . id ) ;
298
+ return hover . domNode ;
299
+ }
300
+
301
+ return undefined ;
302
+ } ) ) ;
303
+
289
304
const template : IChatListItemTemplate = { avatarContainer, agentAvatarContainer, username, detail, referencesListContainer, value, rowContainer, elementDisposables, titleToolbar, templateDisposables, contextKeyService } ;
290
305
return template ;
291
306
}
@@ -295,6 +310,7 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
295
310
}
296
311
297
312
renderChatTreeItem ( element : ChatTreeItem , index : number , templateData : IChatListItemTemplate ) : void {
313
+ templateData . currentElement = element ;
298
314
const kind = isRequestVM ( element ) ? 'request' :
299
315
isResponseVM ( element ) ? 'response' :
300
316
'welcome' ;
@@ -416,11 +432,6 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
416
432
}
417
433
418
434
templateData . detail . textContent = progressMsg ;
419
- if ( element . agent ) {
420
- templateData . detail . title = progressMsg + ( element . slashCommand ?. description ? `\n${ element . slashCommand . description } ` : '' ) ;
421
- } else {
422
- templateData . detail . title = '' ;
423
- }
424
435
}
425
436
426
437
private renderAvatar ( element : ChatTreeItem , templateData : IChatListItemTemplate ) : void {
@@ -1038,7 +1049,7 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
1038
1049
disposables . add ( toDisposable ( ( ) => this . codeBlocksByResponseId . delete ( element . id ) ) ) ;
1039
1050
}
1040
1051
1041
- this . markdownDecorationsRenderer . walkTreeAndAnnotateReferenceLinks ( result . element ) ;
1052
+ disposables . add ( this . markdownDecorationsRenderer . walkTreeAndAnnotateReferenceLinks ( result . element ) ) ;
1042
1053
1043
1054
orderedDisposablesList . reverse ( ) . forEach ( d => disposables . add ( d ) ) ;
1044
1055
return {
0 commit comments