@@ -27,21 +27,21 @@ import { IViewsService } from '../../../../services/views/common/viewsService.js
2727import { showChatView } from '../chat.js' ;
2828import './media/chatConfirmationWidget.css' ;
2929
30- export interface IChatConfirmationButton {
30+ export interface IChatConfirmationButton < T > {
3131 label : string ;
3232 isSecondary ?: boolean ;
3333 tooltip ?: string ;
34- data : any ;
34+ data : T ;
3535 disabled ?: boolean ;
3636 onDidChangeDisablement ?: Event < boolean > ;
37- moreActions ?: ( IChatConfirmationButton | Separator ) [ ] ;
37+ moreActions ?: ( IChatConfirmationButton < T > | Separator ) [ ] ;
3838}
3939
40- export interface IChatConfirmationWidgetOptions {
40+ export interface IChatConfirmationWidgetOptions < T > {
4141 title : string | IMarkdownString ;
4242 message : string | IMarkdownString ;
4343 subtitle ?: string | IMarkdownString ;
44- buttons : IChatConfirmationButton [ ] ;
44+ buttons : IChatConfirmationButton < T > [ ] ;
4545 toolbarData ?: { arg : any ; partType : string ; partSource ?: string } ;
4646}
4747
@@ -105,9 +105,9 @@ export class ChatQueryTitlePart extends Disposable {
105105 }
106106}
107107
108- abstract class BaseSimpleChatConfirmationWidget extends Disposable {
109- private _onDidClick = this . _register ( new Emitter < IChatConfirmationButton > ( ) ) ;
110- get onDidClick ( ) : Event < IChatConfirmationButton > { return this . _onDidClick . event ; }
108+ abstract class BaseSimpleChatConfirmationWidget < T > extends Disposable {
109+ private _onDidClick = this . _register ( new Emitter < IChatConfirmationButton < T > > ( ) ) ;
110+ get onDidClick ( ) : Event < IChatConfirmationButton < T > > { return this . _onDidClick . event ; }
111111
112112 protected _onDidChangeHeight = this . _register ( new Emitter < void > ( ) ) ;
113113 get onDidChangeHeight ( ) : Event < void > { return this . _onDidChangeHeight . event ; }
@@ -132,7 +132,7 @@ abstract class BaseSimpleChatConfirmationWidget extends Disposable {
132132 private readonly notification = this . _register ( new MutableDisposable < DisposableStore > ( ) ) ;
133133
134134 constructor (
135- options : IChatConfirmationWidgetOptions ,
135+ options : IChatConfirmationWidgetOptions < T > ,
136136 @IInstantiationService protected readonly instantiationService : IInstantiationService ,
137137 @IContextMenuService contextMenuService : IContextMenuService ,
138138 @IConfigurationService private readonly _configurationService : IConfigurationService ,
@@ -273,12 +273,12 @@ abstract class BaseSimpleChatConfirmationWidget extends Disposable {
273273}
274274
275275/** @deprecated Use ChatConfirmationWidget instead */
276- export class SimpleChatConfirmationWidget extends BaseSimpleChatConfirmationWidget {
276+ export class SimpleChatConfirmationWidget < T > extends BaseSimpleChatConfirmationWidget < T > {
277277 private _renderedMessage : HTMLElement | undefined ;
278278
279279 constructor (
280280 private readonly _container : HTMLElement ,
281- options : IChatConfirmationWidgetOptions ,
281+ options : IChatConfirmationWidgetOptions < T > ,
282282 @IInstantiationService instantiationService : IInstantiationService ,
283283 @IContextMenuService contextMenuService : IContextMenuService ,
284284 @IConfigurationService configurationService : IConfigurationService ,
@@ -301,18 +301,18 @@ export class SimpleChatConfirmationWidget extends BaseSimpleChatConfirmationWidg
301301 }
302302}
303303
304- export interface IChatConfirmationWidget2Options {
304+ export interface IChatConfirmationWidget2Options < T > {
305305 title : string | IMarkdownString ;
306306 message : string | IMarkdownString | HTMLElement ;
307307 icon ?: ThemeIcon ;
308308 subtitle ?: string | IMarkdownString ;
309- buttons : IChatConfirmationButton [ ] ;
309+ buttons : IChatConfirmationButton < T > [ ] ;
310310 toolbarData ?: { arg : any ; partType : string ; partSource ?: string } ;
311311}
312312
313- abstract class BaseChatConfirmationWidget extends Disposable {
314- private _onDidClick = this . _register ( new Emitter < IChatConfirmationButton > ( ) ) ;
315- get onDidClick ( ) : Event < IChatConfirmationButton > { return this . _onDidClick . event ; }
313+ abstract class BaseChatConfirmationWidget < T > extends Disposable {
314+ private _onDidClick = this . _register ( new Emitter < IChatConfirmationButton < T > > ( ) ) ;
315+ get onDidClick ( ) : Event < IChatConfirmationButton < T > > { return this . _onDidClick . event ; }
316316
317317 protected _onDidChangeHeight = this . _register ( new Emitter < void > ( ) ) ;
318318 get onDidChangeHeight ( ) : Event < void > { return this . _onDidChangeHeight . event ; }
@@ -339,7 +339,7 @@ abstract class BaseChatConfirmationWidget extends Disposable {
339339 private readonly notification = this . _register ( new MutableDisposable < DisposableStore > ( ) ) ;
340340
341341 constructor (
342- options : IChatConfirmationWidget2Options ,
342+ options : IChatConfirmationWidget2Options < T > ,
343343 @IInstantiationService protected readonly instantiationService : IInstantiationService ,
344344 @IContextMenuService private readonly contextMenuService : IContextMenuService ,
345345 @IConfigurationService private readonly _configurationService : IConfigurationService ,
@@ -408,7 +408,7 @@ abstract class BaseChatConfirmationWidget extends Disposable {
408408 }
409409 }
410410
411- updateButtons ( buttons : IChatConfirmationButton [ ] ) {
411+ updateButtons ( buttons : IChatConfirmationButton < T > [ ] ) {
412412 while ( this . _buttonsDomNode . children . length > 0 ) {
413413 this . _buttonsDomNode . children [ 0 ] . remove ( ) ;
414414 }
@@ -501,12 +501,12 @@ abstract class BaseChatConfirmationWidget extends Disposable {
501501 }
502502 }
503503}
504- export class ChatConfirmationWidget extends BaseChatConfirmationWidget {
504+ export class ChatConfirmationWidget < T > extends BaseChatConfirmationWidget < T > {
505505 private _renderedMessage : HTMLElement | undefined ;
506506
507507 constructor (
508508 private readonly _container : HTMLElement ,
509- options : IChatConfirmationWidget2Options ,
509+ options : IChatConfirmationWidget2Options < T > ,
510510 @IInstantiationService instantiationService : IInstantiationService ,
511511 @IContextMenuService contextMenuService : IContextMenuService ,
512512 @IConfigurationService configurationService : IConfigurationService ,
@@ -528,10 +528,10 @@ export class ChatConfirmationWidget extends BaseChatConfirmationWidget {
528528 this . _renderedMessage = renderedMessage . element ;
529529 }
530530}
531- export class ChatCustomConfirmationWidget extends BaseChatConfirmationWidget {
531+ export class ChatCustomConfirmationWidget < T > extends BaseChatConfirmationWidget < T > {
532532 constructor (
533533 container : HTMLElement ,
534- options : IChatConfirmationWidget2Options ,
534+ options : IChatConfirmationWidget2Options < T > ,
535535 @IInstantiationService instantiationService : IInstantiationService ,
536536 @IContextMenuService contextMenuService : IContextMenuService ,
537537 @IConfigurationService configurationService : IConfigurationService ,
0 commit comments