@@ -458,40 +458,43 @@ export class CommentController implements IEditorContribution {
458458
459459 this . onModelChanged ( ) ;
460460 this . codeEditorService . registerDecorationType ( 'comment-controller' , COMMENTEDITOR_DECORATION_KEY , { } ) ;
461- this . commentService . registerContinueOnCommentProvider ( {
462- provideContinueOnComments : ( ) => {
463- const pendingComments : languages . PendingCommentThread [ ] = [ ] ;
464- if ( this . _commentWidgets ) {
465- for ( const zone of this . _commentWidgets ) {
466- const zonePendingComments = zone . getPendingComments ( ) ;
467- const pendingNewComment = zonePendingComments . newComment ;
468- if ( ! pendingNewComment ) {
469- continue ;
470- }
471- let lastCommentBody ;
472- if ( zone . commentThread . comments && zone . commentThread . comments . length ) {
473- const lastComment = zone . commentThread . comments [ zone . commentThread . comments . length - 1 ] ;
474- if ( typeof lastComment . body === 'string' ) {
475- lastCommentBody = lastComment . body ;
476- } else {
477- lastCommentBody = lastComment . body . value ;
461+ this . globalToDispose . add (
462+ this . commentService . registerContinueOnCommentProvider ( {
463+ provideContinueOnComments : ( ) => {
464+ const pendingComments : languages . PendingCommentThread [ ] = [ ] ;
465+ if ( this . _commentWidgets ) {
466+ for ( const zone of this . _commentWidgets ) {
467+ const zonePendingComments = zone . getPendingComments ( ) ;
468+ const pendingNewComment = zonePendingComments . newComment ;
469+ if ( ! pendingNewComment ) {
470+ continue ;
471+ }
472+ let lastCommentBody ;
473+ if ( zone . commentThread . comments && zone . commentThread . comments . length ) {
474+ const lastComment = zone . commentThread . comments [ zone . commentThread . comments . length - 1 ] ;
475+ if ( typeof lastComment . body === 'string' ) {
476+ lastCommentBody = lastComment . body ;
477+ } else {
478+ lastCommentBody = lastComment . body . value ;
479+ }
478480 }
479- }
480481
481- if ( pendingNewComment !== lastCommentBody ) {
482- pendingComments . push ( {
483- owner : zone . owner ,
484- uri : zone . editor . getModel ( ) ! . uri ,
485- range : zone . commentThread . range ,
486- body : pendingNewComment ,
487- isReply : ( zone . commentThread . comments !== undefined ) && ( zone . commentThread . comments . length > 0 )
488- } ) ;
482+ if ( pendingNewComment !== lastCommentBody ) {
483+ pendingComments . push ( {
484+ owner : zone . owner ,
485+ uri : zone . editor . getModel ( ) ! . uri ,
486+ range : zone . commentThread . range ,
487+ body : pendingNewComment ,
488+ isReply : ( zone . commentThread . comments !== undefined ) && ( zone . commentThread . comments . length > 0 )
489+ } ) ;
490+ }
489491 }
490492 }
493+ return pendingComments ;
491494 }
492- return pendingComments ;
493- }
494- } ) ;
495+ } )
496+ ) ;
497+
495498 }
496499
497500 private registerEditorListeners ( ) {
0 commit comments