diff options
author | Alex Ross <alros@microsoft.com> | 2022-07-27 19:05:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-27 19:05:02 +0300 |
commit | 3cd638046c65a47a604ad995954b5fdda29ccce6 (patch) | |
tree | 22fc2d6f3d12fffa310482671502c741f28bea6c /src/vs | |
parent | 43bce132f90421f58e8b83e6cbdc708bf9feffd3 (diff) |
Quick Diff editor gutter decoration hidden by comment gutter icon (diamond) (#156448)
* Quick Diff editor gutter decoration hidden by comment gutter icon (diamond)
Fixes #156264
* Update doc
Diffstat (limited to 'src/vs')
-rw-r--r-- | src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts b/src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts index 41ed64d6d55..5f859a45b0a 100644 --- a/src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts +++ b/src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts @@ -664,6 +664,7 @@ export class CommentController implements IEditorContribution { const pendingCommentText = this._pendingCommentCache[e.owner] && this._pendingCommentCache[e.owner][thread.threadId!]; this.displayCommentThread(e.owner, thread, pendingCommentText); this._commentInfos.filter(info => info.owner === e.owner)[0].threads.push(thread); + this.tryUpdateReservedSpace(); }); this._commentThreadRangeDecorator.update(this.editor, commentInfo); })); @@ -841,15 +842,14 @@ export class CommentController implements IEditorContribution { return; } - private setComments(commentInfos: ICommentInfo[]): void { - if (!this.editor || !this.commentService.isCommentingEnabled) { - return; - } - - this._commentInfos = commentInfos; + private tryUpdateReservedSpace() { let lineDecorationsWidth: number = this.editor.getLayoutInfo().decorationsWidth; + const hasCommentsOrRanges = this._commentInfos.some(info => { + const hasRanges = Boolean(info.commentingRanges && (Array.isArray(info.commentingRanges) ? info.commentingRanges : info.commentingRanges.ranges).length); + return hasRanges || (info.threads.length > 0); + }); - if (this._commentInfos.some(info => Boolean(info.commentingRanges && (Array.isArray(info.commentingRanges) ? info.commentingRanges : info.commentingRanges.ranges).length))) { + if (hasCommentsOrRanges) { this._workspaceHasCommenting.set(true); if (!this._commentingRangeSpaceReserved) { this._commentingRangeSpaceReserved = true; @@ -879,7 +879,15 @@ export class CommentController implements IEditorContribution { }); } } + } + private setComments(commentInfos: ICommentInfo[]): void { + if (!this.editor || !this.commentService.isCommentingEnabled) { + return; + } + + this._commentInfos = commentInfos; + this.tryUpdateReservedSpace(); // create viewzones this.removeCommentWidgetsAndStoreCache(); |