@@ -16,8 +16,9 @@ import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensio
16
16
import { ExtHostDocuments } from 'vs/workbench/api/common/extHostDocuments' ;
17
17
import * as extHostTypeConverter from 'vs/workbench/api/common/extHostTypeConverters' ;
18
18
import * as types from 'vs/workbench/api/common/extHostTypes' ;
19
+ import { checkProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions' ;
19
20
import type * as vscode from 'vscode' ;
20
- import { ExtHostCommentsShape , IMainContext , MainContext , CommentThreadChanges } from './extHost.protocol' ;
21
+ import { ExtHostCommentsShape , IMainContext , MainContext , CommentThreadChanges , CommentChanges } from './extHost.protocol' ;
21
22
import { ExtHostCommands } from './extHostCommands' ;
22
23
23
24
type ProviderHandle = number ;
@@ -346,7 +347,7 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
346
347
private _uri : vscode . Uri ,
347
348
private _range : vscode . Range ,
348
349
private _comments : vscode . Comment [ ] ,
349
- extensionId : ExtensionIdentifier
350
+ public readonly extensionDescription : IExtensionDescription
350
351
) {
351
352
this . _acceptInputDisposables . value = new DisposableStore ( ) ;
352
353
@@ -360,7 +361,7 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
360
361
this . _id ,
361
362
this . _uri ,
362
363
extHostTypeConverter . Range . from ( this . _range ) ,
363
- extensionId
364
+ extensionDescription . identifier
364
365
) ;
365
366
366
367
this . _localDisposables = [ ] ;
@@ -433,7 +434,7 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
433
434
}
434
435
if ( modified ( 'comments' ) ) {
435
436
formattedModifications . comments =
436
- this . _comments . map ( cmt => convertToModeComment ( this , cmt , this . _commentsMap ) ) ;
437
+ this . _comments . map ( cmt => convertToDTOComment ( this , cmt , this . _commentsMap ) ) ;
437
438
}
438
439
if ( modified ( 'collapsibleState' ) ) {
439
440
formattedModifications . collapseState = convertToCollapsibleState ( this . _collapseState ) ;
@@ -561,18 +562,18 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
561
562
createCommentThread ( resource : vscode . Uri , range : vscode . Range , comments : vscode . Comment [ ] ) : ExtHostCommentThread ;
562
563
createCommentThread ( arg0 : vscode . Uri | string , arg1 : vscode . Uri | vscode . Range , arg2 : vscode . Range | vscode . Comment [ ] , arg3 ?: vscode . Comment [ ] ) : vscode . CommentThread {
563
564
if ( typeof arg0 === 'string' ) {
564
- const commentThread = new ExtHostCommentThread ( this . id , this . handle , arg0 , arg1 as vscode . Uri , arg2 as vscode . Range , arg3 as vscode . Comment [ ] , this . _extension . identifier ) ;
565
+ const commentThread = new ExtHostCommentThread ( this . id , this . handle , arg0 , arg1 as vscode . Uri , arg2 as vscode . Range , arg3 as vscode . Comment [ ] , this . _extension ) ;
565
566
this . _threads . set ( commentThread . handle , commentThread ) ;
566
567
return commentThread ;
567
568
} else {
568
- const commentThread = new ExtHostCommentThread ( this . id , this . handle , undefined , arg0 as vscode . Uri , arg1 as vscode . Range , arg2 as vscode . Comment [ ] , this . _extension . identifier ) ;
569
+ const commentThread = new ExtHostCommentThread ( this . id , this . handle , undefined , arg0 as vscode . Uri , arg1 as vscode . Range , arg2 as vscode . Comment [ ] , this . _extension ) ;
569
570
this . _threads . set ( commentThread . handle , commentThread ) ;
570
571
return commentThread ;
571
572
}
572
573
}
573
574
574
575
$createCommentThreadTemplate ( uriComponents : UriComponents , range : IRange ) : ExtHostCommentThread {
575
- const commentThread = new ExtHostCommentThread ( this . id , this . handle , undefined , URI . revive ( uriComponents ) , extHostTypeConverter . Range . to ( range ) , [ ] , this . _extension . identifier ) ;
576
+ const commentThread = new ExtHostCommentThread ( this . id , this . handle , undefined , URI . revive ( uriComponents ) , extHostTypeConverter . Range . to ( range ) , [ ] , this . _extension ) ;
576
577
commentThread . collapsibleState = modes . CommentThreadCollapsibleState . Expanded ;
577
578
this . _threads . set ( commentThread . handle , commentThread ) ;
578
579
return commentThread ;
@@ -608,7 +609,7 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
608
609
}
609
610
}
610
611
611
- function convertToModeComment ( thread : ExtHostCommentThread , vscodeComment : vscode . Comment , commentsMap : Map < vscode . Comment , number > ) : modes . Comment {
612
+ function convertToDTOComment ( thread : ExtHostCommentThread , vscodeComment : vscode . Comment , commentsMap : Map < vscode . Comment , number > ) : CommentChanges {
612
613
let commentUniqueId = commentsMap . get ( vscodeComment ) ! ;
613
614
if ( ! commentUniqueId ) {
614
615
commentUniqueId = ++ thread . commentHandle ;
@@ -617,6 +618,20 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
617
618
618
619
const iconPath = vscodeComment . author && vscodeComment . author . iconPath ? vscodeComment . author . iconPath . toString ( ) : undefined ;
619
620
621
+ if ( vscodeComment . detail ) {
622
+ checkProposedApiEnabled ( thread . extensionDescription , 'commentTimestamp' ) ;
623
+ }
624
+
625
+ let detail : { $mid : MarshalledId . Date , source : any } | string | undefined ;
626
+ if ( vscodeComment . detail && ( typeof vscodeComment . detail !== 'string' ) ) {
627
+ detail = {
628
+ source : vscodeComment . detail ,
629
+ $mid : MarshalledId . Date
630
+ } ;
631
+ } else {
632
+ detail = vscodeComment . detail ;
633
+ }
634
+
620
635
return {
621
636
mode : vscodeComment . mode ,
622
637
contextValue : vscodeComment . contextValue ,
@@ -625,7 +640,8 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
625
640
userName : vscodeComment . author . name ,
626
641
userIconPath : iconPath ,
627
642
label : vscodeComment . label ,
628
- commentReactions : vscodeComment . reactions ? vscodeComment . reactions . map ( reaction => convertToReaction ( reaction ) ) : undefined
643
+ commentReactions : vscodeComment . reactions ? vscodeComment . reactions . map ( reaction => convertToReaction ( reaction ) ) : undefined ,
644
+ detail : detail
629
645
} ;
630
646
}
631
647
@@ -661,3 +677,4 @@ export function createExtHostComments(mainContext: IMainContext, commands: ExtHo
661
677
662
678
return new ExtHostCommentsImpl ( ) ;
663
679
}
680
+
0 commit comments