From 2df36ae3bebbef3ddc4b2ccd960a713f1a3f6e51 Mon Sep 17 00:00:00 2001 From: Remi Schnekenburger Date: Tue, 6 Dec 2022 11:59:15 +0100 Subject: [PATCH] Adding timestamp to comment. fixes #11702 * Adds timestamp comment optional property * Timestamp displayed in comment thread widget if defined Contributed by STMicroelectronics Signed-off-by: Remi SCHNEKENBURGER --- packages/plugin-ext/src/common/plugin-api-rpc-model.ts | 1 + .../src/main/browser/comments/comment-thread-widget.tsx | 1 + packages/plugin-ext/src/main/browser/style/comments.css | 6 ++++++ packages/plugin-ext/src/plugin/comments.ts | 1 + packages/plugin/src/theia.d.ts | 5 +++++ 5 files changed, 14 insertions(+) diff --git a/packages/plugin-ext/src/common/plugin-api-rpc-model.ts b/packages/plugin-ext/src/common/plugin-api-rpc-model.ts index 658c34d950551..ebd5404d224c0 100644 --- a/packages/plugin-ext/src/common/plugin-api-rpc-model.ts +++ b/packages/plugin-ext/src/common/plugin-api-rpc-model.ts @@ -660,6 +660,7 @@ export interface Comment { readonly contextValue?: string; readonly label?: string; readonly mode?: CommentMode; + readonly timeStamp?: Date; } export enum CommentThreadCollapsibleState { diff --git a/packages/plugin-ext/src/main/browser/comments/comment-thread-widget.tsx b/packages/plugin-ext/src/main/browser/comments/comment-thread-widget.tsx index c8e205dd4283a..4ead175c9c06f 100644 --- a/packages/plugin-ext/src/main/browser/comments/comment-thread-widget.tsx +++ b/packages/plugin-ext/src/main/browser/comments/comment-thread-widget.tsx @@ -479,6 +479,7 @@ export class ReviewComment

{comment.userName} + {comment.timeStamp} {comment.label}
diff --git a/packages/plugin-ext/src/main/browser/style/comments.css b/packages/plugin-ext/src/main/browser/style/comments.css index a167d08f2960b..265243a1fb6e9 100644 --- a/packages/plugin-ext/src/main/browser/style/comments.css +++ b/packages/plugin-ext/src/main/browser/style/comments.css @@ -149,6 +149,12 @@ line-height: var(--theia-content-line-height); } +.monaco-editor .review-widget .body .review-comment .review-comment-contents .timestamp { + line-height: var(--theia-content-line-height); + margin: 0 5px 0 5px; + padding: 0 2px 0 2px; +} + .monaco-editor .review-widget .body .review-comment .review-comment-contents .isPending { margin: 0 5px 0 5px; padding: 0 2px 0 2px; diff --git a/packages/plugin-ext/src/plugin/comments.ts b/packages/plugin-ext/src/plugin/comments.ts index efa1e1da3245f..6cbd09f1756d8 100644 --- a/packages/plugin-ext/src/plugin/comments.ts +++ b/packages/plugin-ext/src/plugin/comments.ts @@ -500,6 +500,7 @@ function convertToModeComment(thread: ExtHostCommentThread, commentController: C userName: theiaComment.author.name, userIconPath: iconPath, label: theiaComment.label, + timeStamp: theiaComment.timeStamp }; } diff --git a/packages/plugin/src/theia.d.ts b/packages/plugin/src/theia.d.ts index 869976cc8b36e..4141da0f5a67f 100644 --- a/packages/plugin/src/theia.d.ts +++ b/packages/plugin/src/theia.d.ts @@ -12084,6 +12084,11 @@ export module '@theia/plugin' { * Label will be rendered next to authorName if exists. */ label?: string; + + /** + * Optional timestamp. + */ + timeStamp?: Date; } /**