@@ -29,7 +29,7 @@ import { IMenu, MenuItemAction, SubmenuItemAction } from 'vs/platform/actions/co
29
29
import { IContextKey , IContextKeyService } from 'vs/platform/contextkey/common/contextkey' ;
30
30
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
31
31
import { IOpenerService } from 'vs/platform/opener/common/opener' ;
32
- import { contrastBorder , editorForeground , focusBorder , inputValidationErrorBackground , inputValidationErrorBorder , inputValidationErrorForeground , resolveColorValue , textBlockQuoteBackground , textBlockQuoteBorder , textLinkActiveForeground , textLinkForeground } from 'vs/platform/theme/common/colorRegistry' ;
32
+ import { contrastBorder , editorForeground , registerColor , focusBorder , inputValidationErrorBackground , inputValidationErrorBorder , inputValidationErrorForeground , resolveColorValue , textBlockQuoteBackground , textBlockQuoteBorder , textLinkActiveForeground , textLinkForeground } from 'vs/platform/theme/common/colorRegistry' ;
33
33
import { IColorTheme , IThemeService , ThemeIcon } from 'vs/platform/theme/common/themeService' ;
34
34
import { CommentFormActions } from 'vs/workbench/contrib/comments/browser/commentFormActions' ;
35
35
import { CommentGlyphWidget } from 'vs/workbench/contrib/comments/browser/commentGlyphWidget' ;
@@ -57,6 +57,21 @@ const COLLAPSE_ACTION_CLASS = 'expand-review-action ' + ThemeIcon.asClassName(co
57
57
const COMMENT_SCHEME = 'comment' ;
58
58
59
59
60
+ export const resolvedCommentBorder = registerColor ( 'resolvedComment.border' , { dark : Color . fromHex ( '#c5c5c5' ) , light : Color . fromHex ( '#555' ) , hc : contrastBorder } , nls . localize ( 'resolvedCommentBorder' , 'Color of borders and arrow for resolved comments.' ) ) ;
61
+ export const unresolvedCommentBorder = registerColor ( 'unresolvedComment.border' , { dark : Color . fromHex ( '#f4cd5d' ) , light : Color . fromHex ( '#ff0' ) , hc : contrastBorder } , nls . localize ( 'unresolvedCommentBorder' , 'Color of borders and arrow for unresolved comments.' ) ) ;
62
+
63
+ const commentThreadStateColors = new Map ( [
64
+ [ languages . CommentThreadState . Unresolved , unresolvedCommentBorder ] ,
65
+ [ languages . CommentThreadState . Resolved , resolvedCommentBorder ] ,
66
+ ] ) ;
67
+
68
+ const commentThreadStateColorVar = '--comment-thread-state-color' ;
69
+
70
+ function getCommentThreadStateColor ( thread : languages . CommentThread , theme : IColorTheme ) : Color | undefined {
71
+ const colorId = thread . state !== undefined ? commentThreadStateColors . get ( thread . state ) : undefined ;
72
+ return colorId !== undefined ? theme . getColor ( colorId ) : undefined ;
73
+ }
74
+
60
75
export function parseMouseDownInfoFromEvent ( e : IEditorMouseEvent ) {
61
76
const range = e . target . range ;
62
77
@@ -639,8 +654,14 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
639
654
await this . update ( this . _commentThread ) ;
640
655
} ) ) ;
641
656
642
- this . _commentThreadDisposables . push ( this . _commentThread . onDidChangeState ( async _ => {
643
- await this . update ( this . _commentThread ) ;
657
+ this . _commentThreadDisposables . push ( this . _commentThread . onDidChangeState ( ( ) => {
658
+ const borderColor =
659
+ getCommentThreadStateColor ( this . _commentThread , this . themeService . getColorTheme ( ) ) || Color . transparent ;
660
+ this . style ( {
661
+ frameColor : borderColor ,
662
+ arrowColor : borderColor ,
663
+ } ) ;
664
+ this . container ?. style . setProperty ( commentThreadStateColorVar , `${ borderColor } ` ) ;
644
665
} ) ) ;
645
666
646
667
this . _commentThreadDisposables . push ( this . _commentThread . onDidChangeLabel ( _ => {
@@ -894,17 +915,16 @@ export class ReviewZoneWidget extends ZoneWidget implements ICommentThreadWidget
894
915
}
895
916
896
917
private _applyTheme ( theme : IColorTheme ) {
897
- const borderColor = Color . fromHex ( '#ff0000' ) || theme . getColor ( peekViewBorder ) ;
918
+ const borderColor = getCommentThreadStateColor ( this . _commentThread , theme ) || Color . transparent ;
898
919
this . style ( {
899
- arrowColor : borderColor || Color . transparent ,
900
- frameColor : borderColor || Color . transparent
920
+ arrowColor : borderColor ,
921
+ frameColor : borderColor ,
901
922
} ) ;
902
923
903
924
const content : string [ ] = [ ] ;
904
925
905
- if ( borderColor ) {
906
- content . push ( `.monaco-editor .review-widget > .body { border-top: 1px solid ${ borderColor } }` ) ;
907
- }
926
+ this . container ?. style . setProperty ( commentThreadStateColorVar , `${ borderColor } ` ) ;
927
+ content . push ( `.monaco-editor .review-widget > .body { border-top: 1px solid var(${ commentThreadStateColorVar } ) }` ) ;
908
928
909
929
const linkColor = theme . getColor ( textLinkForeground ) ;
910
930
if ( linkColor ) {
0 commit comments