Skip to content

Commit d2364c6

Browse files
authored
Add user setting for disabling comment max height (microsoft#185301)
Fixes microsoft#181846
1 parent 518a183 commit d2364c6

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import { SmoothScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollable
4646
import { DomEmitter } from 'vs/base/browser/event';
4747
import { CommentContextKeys } from 'vs/workbench/contrib/comments/common/commentContextKeys';
4848
import { FileAccess } from 'vs/base/common/network';
49+
import { COMMENTS_SECTION, ICommentsConfiguration } from 'vs/workbench/contrib/comments/common/commentsConfiguration';
4950

5051
class CommentsActionRunner extends ActionRunner {
5152
protected override async runAction(action: IAction, context: any[]): Promise<void> {
@@ -131,6 +132,9 @@ export class CommentNode<T extends IRange | ICellRange> extends Disposable {
131132
this.createHeader(this._commentDetailsContainer);
132133
this._body = document.createElement(`div`);
133134
this._body.classList.add('comment-body', MOUSE_CURSOR_TEXT_CSS_CLASS_NAME);
135+
if (configurationService.getValue<ICommentsConfiguration | undefined>(COMMENTS_SECTION)?.maxHeight !== false) {
136+
this._body.classList.add('comment-body-max-height');
137+
}
134138

135139
this.createScroll(this._commentDetailsContainer, this._body);
136140
this.updateCommentBody(this.comment.body);

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).regis
3939
type: 'boolean',
4040
default: true,
4141
description: nls.localize('comments.visible', "Controls the visibility of the comments bar and comment threads in editors that have commenting ranges and comments. Comments are still accessible via the Comments view and will cause commenting to be toggled on in the same way running the command \"Comments: Toggle Editor Commenting\" toggles comments.")
42+
},
43+
'comments.maxHeight': {
44+
type: 'boolean',
45+
default: true,
46+
description: nls.localize('comments.maxHeight', "Controls whether the comments widget scrolls or expands.")
4247
}
4348
}
4449
});

src/vs/workbench/contrib/comments/browser/media/review.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@
136136

137137
.review-widget .body .review-comment .review-comment-contents .comment-body {
138138
padding-top: 4px;
139+
}
140+
141+
.review-widget .body .review-comment .review-comment-contents .comment-body-max-height {
139142
max-height: 20em;
140143
}
141144

src/vs/workbench/contrib/comments/common/commentsConfiguration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export interface ICommentsConfiguration {
77
openView: 'never' | 'file' | 'firstFile';
88
useRelativeTime: boolean;
99
visible: boolean;
10+
maxHeight: boolean;
1011
}
1112

1213
export const COMMENTS_SECTION = 'comments';

0 commit comments

Comments
 (0)