Skip to content

Commit 6b9964e

Browse files
authored
Remove comments reserved space when commenting is off (microsoft#167165)
Part of microsoft#162352
1 parent f421b1b commit 6b9964e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ export class CommentController implements IEditorContribution {
399399
this.registerEditorListeners();
400400
this.beginCompute();
401401
} else {
402+
this.tryUpdateReservedSpace();
402403
this.clearEditorListeners();
403404
this._commentingRangeDecorator.update(this.editor, []);
404405
this._commentThreadRangeDecorator.update(this.editor, []);
@@ -949,13 +950,13 @@ export class CommentController implements IEditorContribution {
949950
return hasRanges || (info.threads.length > 0);
950951
});
951952

952-
if (hasCommentsOrRanges && !this._commentingRangeSpaceReserved) {
953+
if (hasCommentsOrRanges && !this._commentingRangeSpaceReserved && this.commentService.isCommentingEnabled) {
953954
this._workspaceHasCommenting.set(true);
954955
this._commentingRangeSpaceReserved = true;
955956
const { lineDecorationsWidth, extraEditorClassName } = this.getExistingCommentEditorOptions(this.editor);
956957
const newOptions = this.getWithCommentsEditorOptions(this.editor, extraEditorClassName, lineDecorationsWidth);
957958
this.updateEditorLayoutOptions(this.editor, newOptions.extraEditorClassName, newOptions.lineDecorationsWidth);
958-
} else if (!hasCommentsOrRanges && this._commentingRangeSpaceReserved) {
959+
} else if ((!hasCommentsOrRanges || !this.commentService.isCommentingEnabled) && this._commentingRangeSpaceReserved) {
959960
this._commentingRangeSpaceReserved = false;
960961
const { lineDecorationsWidth, extraEditorClassName } = this.getExistingCommentEditorOptions(this.editor);
961962
const newOptions = this.getWithoutCommentsEditorOptions(this.editor, extraEditorClassName, lineDecorationsWidth);

0 commit comments

Comments
 (0)