Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 0 additions & 65 deletions src/vs/workbench/contrib/comments/browser/commentThreadWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import './media/review.css';
import * as dom from '../../../../base/browser/dom.js';
import * as domStylesheets from '../../../../base/browser/domStylesheets.js';
import { Emitter } from '../../../../base/common/event.js';
import { Disposable, dispose, IDisposable, toDisposable } from '../../../../base/common/lifecycle.js';
import { URI } from '../../../../base/common/uri.js';
Expand All @@ -22,10 +21,7 @@ import { CommentThreadAdditionalActions } from './commentThreadAdditionalActions
import { CommentContextKeys } from '../common/commentContextKeys.js';
import { ICommentThreadWidget } from '../common/commentThreadWidget.js';
import { IColorTheme } from '../../../../platform/theme/common/themeService.js';
import { contrastBorder, focusBorder, inputValidationErrorBackground, inputValidationErrorBorder, inputValidationErrorForeground, textBlockQuoteBackground, textLinkActiveForeground, textLinkForeground } from '../../../../platform/theme/common/colorRegistry.js';
import { PANEL_BORDER } from '../../../common/theme.js';
import { IRange, Range } from '../../../../editor/common/core/range.js';
import { commentThreadStateBackgroundColorVar, commentThreadStateColorVar } from './commentColors.js';
import { ICellRange } from '../../notebook/common/notebookRange.js';
import { FontInfo } from '../../../../editor/common/config/fontInfo.js';
import { registerNavigableContainer } from '../../../browser/actions/widgetNavigationCommands.js';
Expand All @@ -48,7 +44,6 @@ export class CommentThreadWidget<T extends IRange | ICellRange = IRange> extends
private _commentMenus: CommentMenus;
private _commentThreadDisposables: IDisposable[] = [];
private _threadIsEmpty: IContextKey<boolean>;
private _styleElement: HTMLStyleElement;
private _commentThreadContextValue: IContextKey<string | undefined>;
private _focusedContextKey: IContextKey<boolean>;
private _onDidResize = new Emitter<dom.Dimension>();
Expand Down Expand Up @@ -139,8 +134,6 @@ export class CommentThreadWidget<T extends IRange | ICellRange = IRange> extends
) as unknown as CommentThreadBody<T>;
this._register(this._body);
this._setAriaLabel();
this._styleElement = domStylesheets.createStyleSheet(this.container);


this._commentThreadContextValue = CommentContextKeys.commentThreadContext.bindTo(this._contextKeyService);
this._commentThreadContextValue.set(_commentThread.contextValue);
Expand Down Expand Up @@ -383,71 +376,13 @@ export class CommentThreadWidget<T extends IRange | ICellRange = IRange> extends
}

applyTheme(theme: IColorTheme, fontInfo: FontInfo) {
const content: string[] = [];

content.push(`.monaco-editor .review-widget > .body { border-top: 1px solid var(${commentThreadStateColorVar}) }`);
content.push(`.monaco-editor .review-widget > .head { background-color: var(${commentThreadStateBackgroundColorVar}) }`);

const linkColor = theme.getColor(textLinkForeground);
if (linkColor) {
content.push(`.review-widget .body .comment-body a { color: ${linkColor} }`);
}

const linkActiveColor = theme.getColor(textLinkActiveForeground);
if (linkActiveColor) {
content.push(`.review-widget .body .comment-body a:hover, a:active { color: ${linkActiveColor} }`);
}

const focusColor = theme.getColor(focusBorder);
if (focusColor) {
content.push(`.review-widget .body .comment-body a:focus { outline: 1px solid ${focusColor}; }`);
content.push(`.review-widget .body .monaco-editor.focused { outline: 1px solid ${focusColor}; }`);
}

const blockQuoteBackground = theme.getColor(textBlockQuoteBackground);
if (blockQuoteBackground) {
content.push(`.review-widget .body .review-comment blockquote { background: ${blockQuoteBackground}; }`);
}

const border = theme.getColor(PANEL_BORDER);
if (border) {
content.push(`.review-widget .body .review-comment .review-comment-contents .comment-reactions .action-item a.action-label { border-color: ${border}; }`);
}

const hcBorder = theme.getColor(contrastBorder);
if (hcBorder) {
content.push(`.review-widget .body .comment-form .review-thread-reply-button { outline-color: ${hcBorder}; }`);
content.push(`.review-widget .body .monaco-editor { outline: 1px solid ${hcBorder}; }`);
}

const errorBorder = theme.getColor(inputValidationErrorBorder);
if (errorBorder) {
content.push(`.review-widget .validation-error { border: 1px solid ${errorBorder}; }`);
}

const errorBackground = theme.getColor(inputValidationErrorBackground);
if (errorBackground) {
content.push(`.review-widget .validation-error { background: ${errorBackground}; }`);
}

const errorForeground = theme.getColor(inputValidationErrorForeground);
if (errorForeground) {
content.push(`.review-widget .body .comment-form .validation-error { color: ${errorForeground}; }`);
}

const fontFamilyVar = '--comment-thread-editor-font-family';
const fontSizeVar = '--comment-thread-editor-font-size';
const fontWeightVar = '--comment-thread-editor-font-weight';
this.container?.style.setProperty(fontFamilyVar, fontInfo.fontFamily);
this.container?.style.setProperty(fontSizeVar, `${fontInfo.fontSize}px`);
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --comment-thread-editor-font-size CSS custom property is being set but is never used in the CSS file. Consider either using it in review.css (e.g., in the .review-widget .body code rule) or removing the fontSizeVar assignment to avoid setting unused CSS properties.

Copilot uses AI. Check for mistakes.
this.container?.style.setProperty(fontWeightVar, fontInfo.fontWeight);

content.push(`.review-widget .body code {
font-family: var(${fontFamilyVar});
font-weight: var(${fontWeightVar});
}`);

this._styleElement.textContent = content.join('\n');
this._commentReply?.setCommentEditorDecorations();
}
}
40 changes: 40 additions & 0 deletions src/vs/workbench/contrib/comments/browser/media/review.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@
border-left-color: var(--vscode-textBlockQuote-border);
}

.review-widget .body .review-comment blockquote {
background: var(--vscode-textBlockQuote-background);
}

.review-widget .body .review-comment .avatar-container {
margin-top: 4px !important;
}
Expand Down Expand Up @@ -194,6 +198,7 @@

.review-widget .body .review-comment .review-comment-contents .comment-reactions .action-item a.action-label {
border: 1px solid;
border-color: var(--vscode-panel-border);
}

.review-widget .body .review-comment .review-comment-contents .comment-reactions .action-item a.action-label.disabled {
Expand All @@ -210,6 +215,16 @@
}
.review-widget .body .review-comment .review-comment-contents .comment-body a {
cursor: pointer;
color: var(--vscode-textLink-foreground);
}

.review-widget .body .comment-body a:hover,
.review-widget .body .comment-body a:active {
color: var(--vscode-textLink-activeForeground);
}

.review-widget .body .comment-body a:focus {
outline: 1px solid var(--vscode-focusBorder);
}

.review-widget .body .comment-body p,
Expand Down Expand Up @@ -269,6 +284,12 @@
margin-top: -1px;
margin-left: -1px;
word-wrap: break-word;
border: 1px solid var(--vscode-inputValidation-errorBorder);
background: var(--vscode-inputValidation-errorBackground);
}

.review-widget .body .comment-form .validation-error {
color: var(--vscode-inputValidation-errorForeground);
}


Expand Down Expand Up @@ -310,6 +331,11 @@
color: var(--vscode-editor-foreground);
}

.review-widget .body code {
font-family: var(--comment-thread-editor-font-family);
font-weight: var(--comment-thread-editor-font-weight);
}

.review-widget .body .comment-form-container .comment-form {
display: flex;
flex-direction: row;
Expand Down Expand Up @@ -342,6 +368,7 @@
white-space: nowrap;
border: 0px;
outline: 1px solid transparent;
outline-color: var(--vscode-contrastBorder);
background-color: var(--vscode-editorCommentsWidget-replyInputBackground);
color: var(--vscode-editor-foreground);
font-size: inherit;
Expand All @@ -368,6 +395,11 @@
border: 0px;
box-sizing: content-box;
padding: 6px 0 6px 12px;
outline: 1px solid var(--vscode-contrastBorder);
}

.review-widget .body .monaco-editor.focused {
outline: 1px solid var(--vscode-focusBorder);
}

.review-widget .body .comment-form-container .monaco-editor,
Expand Down Expand Up @@ -454,6 +486,14 @@
margin: 0;
}

.monaco-editor .review-widget > .body {
border-top: 1px solid var(--comment-thread-state-color);
}

.monaco-editor .review-widget > .head {
background-color: var(--comment-thread-state-background-color);
}

.review-widget > .body {
border-top: 1px solid;
position: relative;
Expand Down
Loading