Skip to content

Commit 9ee3bb7

Browse files
authored
Adding a comment shows up twice in the UI in VS Code (microsoft#186147)
Fixes microsoft#185644
1 parent 9a9264c commit 9ee3bb7

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

src/vs/workbench/contrib/comments/browser/commentFormActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class CommentFormActions implements IDisposable {
5656
const lastAction = this._actions[0];
5757

5858
if (lastAction.enabled) {
59-
this.actionHandler(lastAction);
59+
return this.actionHandler(lastAction);
6060
}
6161
}
6262
}

src/vs/workbench/contrib/comments/browser/commentReply.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export class CommentReply<T extends IRange | ICellRange> extends Disposable {
165165
}
166166

167167
async submitComment(): Promise<void> {
168-
this._commentFormActions?.triggerDefaultAction();
168+
return this._commentFormActions?.triggerDefaultAction();
169169
}
170170

171171
setCommentEditorDecorations() {
@@ -311,6 +311,7 @@ export class CommentReply<T extends IRange | ICellRange> extends Disposable {
311311

312312
private hideReplyArea() {
313313
this.commentEditor.getDomNode()!.style.outline = '';
314+
this.commentEditor.setValue('');
314315
this._pendingComment = '';
315316
this.form.classList.remove('expand');
316317
this._error.textContent = '';

src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,9 @@ export class CommentThreadWidget<T extends IRange | ICellRange = IRange> extends
296296
async submitComment() {
297297
const activeComment = this._body.activeComment;
298298
if (activeComment) {
299-
activeComment.submitComment();
299+
return activeComment.submitComment();
300300
} else if ((this._commentReply?.getPendingComment()?.length ?? 0) > 0) {
301-
this._commentReply?.submitComment();
301+
return this._commentReply?.submitComment();
302302
}
303303
}
304304

src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
413413
}
414414

415415
async submitComment(): Promise<void> {
416-
this._commentThreadWidget.submitComment();
416+
return this._commentThreadWidget.submitComment();
417417
}
418418

419419
_refresh(dimensions: dom.Dimension) {

0 commit comments

Comments
 (0)