@@ -464,8 +464,8 @@ export class CommentController implements IEditorContribution {
464
464
private _emptyThreadsToAddQueue : [ Range | undefined , IEditorMouseEvent | undefined ] [ ] = [ ] ;
465
465
private _computeCommentingRangePromise ! : CancelablePromise < ICommentInfo [ ] > | null ;
466
466
private _computeCommentingRangeScheduler ! : Delayer < Array < ICommentInfo | null > > | null ;
467
- private _pendingNewCommentCache : { [ key : string ] : { [ key : string ] : string } } ;
468
- private _pendingEditsCache : { [ key : string ] : { [ key : string ] : { [ key : number ] : string } } } ; // uniqueOwner -> threadId -> uniqueIdInThread -> pending comment
467
+ private _pendingNewCommentCache : { [ key : string ] : { [ key : string ] : languages . PendingComment } } ;
468
+ private _pendingEditsCache : { [ key : string ] : { [ key : string ] : { [ key : number ] : languages . PendingComment } } } ; // uniqueOwner -> threadId -> uniqueIdInThread -> pending comment
469
469
private _inProcessContinueOnComments : Map < string , languages . PendingCommentThread [ ] > = new Map ( ) ;
470
470
private _editorDisposables : IDisposable [ ] = [ ] ;
471
471
private _activeCursorHasCommentingRange : IContextKey < boolean > ;
@@ -578,12 +578,12 @@ export class CommentController implements IEditorContribution {
578
578
}
579
579
}
580
580
581
- if ( pendingNewComment !== lastCommentBody ) {
581
+ if ( pendingNewComment . body !== lastCommentBody ) {
582
582
pendingComments . push ( {
583
583
uniqueOwner : zone . uniqueOwner ,
584
584
uri : zone . editor . getModel ( ) ! . uri ,
585
585
range : zone . commentThread . range ,
586
- body : pendingNewComment ,
586
+ comment : pendingNewComment ,
587
587
isReply : ( zone . commentThread . comments !== undefined ) && ( zone . commentThread . comments . length > 0 )
588
588
} ) ;
589
589
}
@@ -896,7 +896,7 @@ export class CommentController implements IEditorContribution {
896
896
} ) ;
897
897
let continueOnCommentText : string | undefined ;
898
898
if ( ( continueOnCommentIndex !== undefined ) && continueOnCommentIndex >= 0 ) {
899
- continueOnCommentText = this . _inProcessContinueOnComments . get ( uniqueOwner ) ?. splice ( continueOnCommentIndex , 1 ) [ 0 ] . body ;
899
+ continueOnCommentText = this . _inProcessContinueOnComments . get ( uniqueOwner ) ?. splice ( continueOnCommentIndex , 1 ) [ 0 ] . comment . body ;
900
900
}
901
901
902
902
const pendingCommentText = ( this . _pendingNewCommentCache [ uniqueOwner ] && this . _pendingNewCommentCache [ uniqueOwner ] [ thread . threadId ] )
@@ -999,18 +999,18 @@ export class CommentController implements IEditorContribution {
999
999
const matchedZones = this . _commentWidgets . filter ( zoneWidget => zoneWidget . uniqueOwner === thread . uniqueOwner && Range . lift ( zoneWidget . commentThread . range ) ?. equalsRange ( thread . range ) ) ;
1000
1000
if ( thread . isReply && matchedZones . length ) {
1001
1001
this . commentService . removeContinueOnComment ( { uniqueOwner : thread . uniqueOwner , uri : editorURI , range : thread . range , isReply : true } ) ;
1002
- matchedZones [ 0 ] . setPendingComment ( thread . body ) ;
1002
+ matchedZones [ 0 ] . setPendingComment ( thread . comment ) ;
1003
1003
} else if ( matchedZones . length ) {
1004
1004
this . commentService . removeContinueOnComment ( { uniqueOwner : thread . uniqueOwner , uri : editorURI , range : thread . range , isReply : false } ) ;
1005
1005
const existingPendingComment = matchedZones [ 0 ] . getPendingComments ( ) . newComment ;
1006
1006
// We need to try to reconcile the existing pending comment with the incoming pending comment
1007
- let pendingComment : string ;
1008
- if ( ! existingPendingComment || thread . body . includes ( existingPendingComment ) ) {
1009
- pendingComment = thread . body ;
1010
- } else if ( existingPendingComment . includes ( thread . body ) ) {
1007
+ let pendingComment : languages . PendingComment ;
1008
+ if ( ! existingPendingComment || thread . comment . body . includes ( existingPendingComment . body ) ) {
1009
+ pendingComment = thread . comment ;
1010
+ } else if ( existingPendingComment . body . includes ( thread . comment . body ) ) {
1011
1011
pendingComment = existingPendingComment ;
1012
1012
} else {
1013
- pendingComment = `${ existingPendingComment } \n${ thread . body } ` ;
1013
+ pendingComment = { body : `${ existingPendingComment } \n${ thread . comment . body } ` , cursor : thread . comment . cursor } ;
1014
1014
}
1015
1015
matchedZones [ 0 ] . setPendingComment ( pendingComment ) ;
1016
1016
} else if ( ! thread . isReply ) {
@@ -1062,7 +1062,7 @@ export class CommentController implements IEditorContribution {
1062
1062
return undefined ;
1063
1063
}
1064
1064
1065
- private async displayCommentThread ( uniqueOwner : string , thread : languages . CommentThread , shouldReveal : boolean , pendingComment : string | undefined , pendingEdits : { [ key : number ] : string } | undefined ) : Promise < void > {
1065
+ private async displayCommentThread ( uniqueOwner : string , thread : languages . CommentThread , shouldReveal : boolean , pendingComment : languages . PendingComment | undefined , pendingEdits : { [ key : number ] : languages . PendingComment } | undefined ) : Promise < void > {
1066
1066
const editor = this . editor ?. getModel ( ) ;
1067
1067
if ( ! editor ) {
1068
1068
return ;
@@ -1075,7 +1075,7 @@ export class CommentController implements IEditorContribution {
1075
1075
if ( thread . range && ! pendingComment ) {
1076
1076
continueOnCommentReply = this . commentService . removeContinueOnComment ( { uniqueOwner, uri : editor . uri , range : thread . range , isReply : true } ) ;
1077
1077
}
1078
- const zoneWidget = this . instantiationService . createInstance ( ReviewZoneWidget , this . editor , uniqueOwner , thread , pendingComment ?? continueOnCommentReply ?. body , pendingEdits ) ;
1078
+ const zoneWidget = this . instantiationService . createInstance ( ReviewZoneWidget , this . editor , uniqueOwner , thread , pendingComment ?? continueOnCommentReply ?. comment , pendingEdits ) ;
1079
1079
await zoneWidget . display ( thread . range , shouldReveal ) ;
1080
1080
this . _commentWidgets . push ( zoneWidget ) ;
1081
1081
this . openCommentsView ( thread ) ;
@@ -1361,12 +1361,12 @@ export class CommentController implements IEditorContribution {
1361
1361
const providerEditsCacheStore = this . _pendingEditsCache [ info . uniqueOwner ] ;
1362
1362
info . threads = info . threads . filter ( thread => ! thread . isDisposed ) ;
1363
1363
for ( const thread of info . threads ) {
1364
- let pendingComment : string | undefined = undefined ;
1364
+ let pendingComment : languages . PendingComment | undefined = undefined ;
1365
1365
if ( providerCacheStore ) {
1366
1366
pendingComment = providerCacheStore [ thread . threadId ] ;
1367
1367
}
1368
1368
1369
- let pendingEdits : { [ key : number ] : string } | undefined = undefined ;
1369
+ let pendingEdits : { [ key : number ] : languages . PendingComment } | undefined = undefined ;
1370
1370
if ( providerEditsCacheStore ) {
1371
1371
pendingEdits = providerEditsCacheStore [ thread . threadId ] ;
1372
1372
}
@@ -1412,7 +1412,7 @@ export class CommentController implements IEditorContribution {
1412
1412
lastCommentBody = lastComment . body . value ;
1413
1413
}
1414
1414
}
1415
- if ( pendingNewComment && ( pendingNewComment !== lastCommentBody ) ) {
1415
+ if ( pendingNewComment && ( pendingNewComment . body !== lastCommentBody ) ) {
1416
1416
if ( ! providerNewCommentCacheStore ) {
1417
1417
this . _pendingNewCommentCache [ zone . uniqueOwner ] = { } ;
1418
1418
}
0 commit comments