extend
override render(): React.ReactNode {
const { commands, commentThread, contextKeyService } = this.props;
const hasExistingComments = commentThread.comments && commentThread.comments.length > 0;
- return
+ return commentThread.canReply ?
: null;
}
}
diff --git a/packages/plugin-ext/src/main/browser/comments/comments-main.ts b/packages/plugin-ext/src/main/browser/comments/comments-main.ts
index be32a9253c97c..381d5e0fd64ab 100644
--- a/packages/plugin-ext/src/main/browser/comments/comments-main.ts
+++ b/packages/plugin-ext/src/main/browser/comments/comments-main.ts
@@ -124,12 +124,25 @@ export class CommentThreadImpl implements CommentThread, Disposable {
private readonly onDidChangeCollapsibleStateEmitter = new Emitter
();
readonly onDidChangeCollapsibleState = this.onDidChangeCollapsibleStateEmitter.event;
+ private readonly onDidChangeCanReplyEmitter = new Emitter();
+ readonly onDidChangeCanReply = this.onDidChangeCanReplyEmitter.event;
+
private _isDisposed: boolean;
get isDisposed(): boolean {
return this._isDisposed;
}
+ private _canReply: boolean = true;
+ get canReply(): boolean {
+ return this._canReply;
+ }
+
+ set canReply(canReply: boolean) {
+ this._canReply = canReply;
+ this.onDidChangeCanReplyEmitter.fire(this._canReply);
+ }
+
constructor(
public commentThreadHandle: number,
public controllerHandle: number,
@@ -150,6 +163,7 @@ export class CommentThreadImpl implements CommentThread, Disposable {
if (modified('contextValue')) { this._contextValue = changes.contextValue; }
if (modified('comments')) { this._comments = changes.comments; }
if (modified('collapseState')) { this._collapsibleState = changes.collapseState; }
+ if (modified('canReply')) { this._canReply = changes.canReply!; }
}
dispose(): void {
@@ -159,6 +173,7 @@ export class CommentThreadImpl implements CommentThread, Disposable {
this.onDidChangeInputEmitter.dispose();
this.onDidChangeLabelEmitter.dispose();
this.onDidChangeRangeEmitter.dispose();
+ this.onDidChangeCanReplyEmitter.dispose();
}
}
diff --git a/packages/plugin-ext/src/plugin/comments.ts b/packages/plugin-ext/src/plugin/comments.ts
index e1b2e4c75f1b9..b37e44b07bc7a 100644
--- a/packages/plugin-ext/src/plugin/comments.ts
+++ b/packages/plugin-ext/src/plugin/comments.ts
@@ -185,6 +185,7 @@ type CommentThreadModification = Partial<{
contextValue: string | undefined,
comments: theia.Comment[],
collapsibleState: theia.CommentThreadCollapsibleState
+ canReply: boolean;
}>;
export class ExtHostCommentThread implements theia.CommentThread, theia.Disposable {
@@ -283,6 +284,17 @@ export class ExtHostCommentThread implements theia.CommentThread, theia.Disposab
return this._isDisposed;
}
+ private _canReply: boolean = true;
+ get canReply(): boolean {
+ return this._canReply;
+ }
+
+ set canReply(canReply: boolean) {
+ this._canReply = canReply;
+ this.modifications.canReply = canReply;
+ this._onDidUpdateCommentThread.fire();
+ }
+
private commentsMap: Map = new Map();
private acceptInputDisposables = new DisposableCollection();
@@ -345,6 +357,9 @@ export class ExtHostCommentThread implements theia.CommentThread, theia.Disposab
if (modified('collapsibleState')) {
formattedModifications.collapseState = convertToCollapsibleState(this.collapseState);
}
+ if (modified('canReply')) {
+ formattedModifications.canReply = this.canReply;
+ }
this.modifications = {};
this.proxy.$updateCommentThread(
diff --git a/packages/plugin/src/theia.d.ts b/packages/plugin/src/theia.d.ts
index 365e3bbbfdde7..59175bdece292 100644
--- a/packages/plugin/src/theia.d.ts
+++ b/packages/plugin/src/theia.d.ts
@@ -10941,6 +10941,11 @@ export module '@theia/plugin' {
* Once disposed, this comment thread will be removed from visible editors and Comment Panel when appropriate.
*/
dispose(): void;
+
+ /**
+ * Whether the thread supports reply. Defaults to true.
+ */
+ canReply: boolean;
}
/**