@@ -193,12 +193,11 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
193
193
194
194
constructor (
195
195
editorOptions : ChatEditorOptions ,
196
- private readonly rendererOptions : IChatListItemRendererOptions ,
196
+ private rendererOptions : IChatListItemRendererOptions ,
197
197
private readonly delegate : IChatRendererDelegate ,
198
198
private readonly codeBlockModelCollection : CodeBlockModelCollection ,
199
199
overflowWidgetsDomNode : HTMLElement | undefined ,
200
200
private viewModel : IChatViewModel | undefined ,
201
- private disableEdits : boolean = false ,
202
201
@IInstantiationService private readonly instantiationService : IInstantiationService ,
203
202
@IConfigurationService private readonly configService : IConfigurationService ,
204
203
@ILogService private readonly logService : ILogService ,
@@ -222,6 +221,10 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
222
221
this . _toolInvocationCodeBlockCollection = this . _register ( this . instantiationService . createInstance ( CodeBlockModelCollection , 'tools' ) ) ;
223
222
}
224
223
224
+ public updateOptions ( options : IChatListItemRendererOptions ) : void {
225
+ this . rendererOptions = { ...this . rendererOptions , ...options } ;
226
+ }
227
+
225
228
get templateId ( ) : string {
226
229
return ChatListItemRenderer . ID ;
227
230
}
@@ -555,9 +558,11 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
555
558
const isLockedToCodingAgent = ChatContextKeys . lockedToCodingAgent . getValue ( templateData . contextKeyService ) ;
556
559
templateData . checkpointContainer . classList . toggle ( 'hidden' , isResponseVM ( element ) || ! this . configService . getValue < boolean > ( ChatConfiguration . CheckpointsEnabled ) || isLockedToCodingAgent ) ;
557
560
561
+ const checkpointEnabled = this . configService . getValue < boolean > ( ChatConfiguration . CheckpointsEnabled ) && this . rendererOptions . restorable ;
562
+
558
563
// Only show restore container when we have a checkpoint and not editing
559
564
const shouldShowRestore = this . viewModel ?. model . checkpoint && ! this . viewModel ?. editing && ( index === this . delegate . getListLength ( ) - 1 ) ;
560
- templateData . checkpointRestoreContainer . classList . toggle ( 'hidden' , ! shouldShowRestore || ! this . configService . getValue < boolean > ( ChatConfiguration . CheckpointsEnabled ) || isLockedToCodingAgent ) ;
565
+ templateData . checkpointRestoreContainer . classList . toggle ( 'hidden' , ! shouldShowRestore || checkpointEnabled ) ;
561
566
562
567
const editing = element . id === this . viewModel ?. editing ?. id ;
563
568
const isInput = this . configService . getValue < string > ( 'chat.editRequests' ) === 'input' ;
@@ -568,7 +573,7 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
568
573
templateData . requestHover . classList . toggle ( 'editing' , editing && isInput ) ;
569
574
templateData . requestHover . classList . toggle ( 'hidden' , ( ! ! this . viewModel ?. editing && ! editing ) || isResponseVM ( element ) ) ;
570
575
templateData . requestHover . classList . toggle ( 'expanded' , this . configService . getValue < string > ( 'chat.editRequests' ) === 'hover' ) ;
571
- templateData . requestHover . classList . toggle ( 'checkpoints-enabled' , this . configService . getValue < boolean > ( ChatConfiguration . CheckpointsEnabled ) ) ;
576
+ templateData . requestHover . classList . toggle ( 'checkpoints-enabled' , checkpointEnabled ) ;
572
577
templateData . elementDisposables . add ( dom . addDisposableListener ( templateData . rowContainer , dom . EventType . CLICK , ( e ) => {
573
578
const current = templateData . currentElement ;
574
579
if ( current && this . viewModel ?. editing && current . id !== this . viewModel . editing . id ) {
@@ -737,7 +742,7 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
737
742
this . _onDidRerender . fire ( templateData ) ;
738
743
}
739
744
740
- if ( this . configService . getValue < string > ( 'chat.editRequests' ) !== 'none' && ! this . disableEdits ) {
745
+ if ( this . configService . getValue < string > ( 'chat.editRequests' ) !== 'none' && this . rendererOptions . editable ) {
741
746
templateData . elementDisposables . add ( dom . addDisposableListener ( templateData . rowContainer , dom . EventType . KEY_DOWN , e => {
742
747
const ev = new StandardKeyboardEvent ( e ) ;
743
748
if ( ev . equals ( KeyCode . Space ) || ev . equals ( KeyCode . Enter ) ) {
@@ -1363,7 +1368,7 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
1363
1368
const markdownPart = templateData . instantiationService . createInstance ( ChatMarkdownContentPart , markdown , context , this . _editorPool , fillInIncompleteTokens , codeBlockStartIndex , this . renderer , this . _currentLayoutWidth , this . codeBlockModelCollection , { } ) ;
1364
1369
if ( isRequestVM ( element ) ) {
1365
1370
markdownPart . domNode . tabIndex = 0 ;
1366
- if ( this . configService . getValue < string > ( 'chat.editRequests' ) === 'inline' && ! this . disableEdits ) {
1371
+ if ( this . configService . getValue < string > ( 'chat.editRequests' ) === 'inline' && this . rendererOptions . editable ) {
1367
1372
markdownPart . domNode . classList . add ( 'clickable' ) ;
1368
1373
markdownPart . addDisposable ( dom . addDisposableListener ( markdownPart . domNode , dom . EventType . CLICK , ( e : MouseEvent ) => {
1369
1374
if ( this . viewModel ?. editing ?. id === element . id ) {
0 commit comments