@@ -147,15 +147,15 @@ class CommentingRangeDecorator {
147
147
const hoverDecorationOptions : IModelDecorationOptions = {
148
148
description : CommentingRangeDecorator . description ,
149
149
isWholeLine : true ,
150
- linesDecorationsClassName : `comment-range-glyph comment-diff-added line-hover`
150
+ linesDecorationsClassName : `comment-range-glyph line-hover`
151
151
} ;
152
152
153
153
this . hoverDecorationOptions = ModelDecorationOptions . createDynamic ( hoverDecorationOptions ) ;
154
154
155
155
const multilineDecorationOptions : IModelDecorationOptions = {
156
156
description : CommentingRangeDecorator . description ,
157
157
isWholeLine : true ,
158
- linesDecorationsClassName : `comment-range-glyph comment-diff-added multiline-add`
158
+ linesDecorationsClassName : `comment-range-glyph multiline-add`
159
159
} ;
160
160
161
161
this . multilineDecorationOptions = ModelDecorationOptions . createDynamic ( multilineDecorationOptions ) ;
@@ -203,7 +203,7 @@ class CommentingRangeDecorator {
203
203
// If there's only one selection line, then just drop into the else if and show an emphasis line.
204
204
&& ! ( ( intersectingSelectionRange . startLineNumber === intersectingSelectionRange . endLineNumber )
205
205
&& ( emphasisLine === intersectingSelectionRange . startLineNumber ) ) ) {
206
- // The emphasisLine should be the within the commenting range, even if the selection range stretches
206
+ // The emphasisLine should be within the commenting range, even if the selection range stretches
207
207
// outside of the commenting range.
208
208
// Clip the emphasis and selection ranges to the commenting range
209
209
let intersectingEmphasisRange : Range ;
@@ -230,11 +230,15 @@ class CommentingRangeDecorator {
230
230
commentingRangeDecorations . push ( new CommentingRangeDecoration ( editor , info . owner , info . extensionId , info . label , afterRange , this . decorationOptions , info . commentingRanges , true ) ) ;
231
231
}
232
232
} else if ( ( rangeObject . startLineNumber <= emphasisLine ) && ( emphasisLine <= rangeObject . endLineNumber ) ) {
233
- const beforeRange = new Range ( range . startLineNumber , 1 , emphasisLine , 1 ) ;
234
- const afterRange = new Range ( emphasisLine , 1 , range . endLineNumber , 1 ) ;
235
- commentingRangeDecorations . push ( new CommentingRangeDecoration ( editor , info . owner , info . extensionId , info . label , beforeRange , this . decorationOptions , info . commentingRanges , true ) ) ;
233
+ if ( rangeObject . startLineNumber < emphasisLine ) {
234
+ const beforeRange = new Range ( range . startLineNumber , 1 , emphasisLine - 1 , 1 ) ;
235
+ commentingRangeDecorations . push ( new CommentingRangeDecoration ( editor , info . owner , info . extensionId , info . label , beforeRange , this . decorationOptions , info . commentingRanges , true ) ) ;
236
+ }
236
237
commentingRangeDecorations . push ( new CommentingRangeDecoration ( editor , info . owner , info . extensionId , info . label , new Range ( emphasisLine , 1 , emphasisLine , 1 ) , this . hoverDecorationOptions , info . commentingRanges , true ) ) ;
237
- commentingRangeDecorations . push ( new CommentingRangeDecoration ( editor , info . owner , info . extensionId , info . label , afterRange , this . decorationOptions , info . commentingRanges , true ) ) ;
238
+ if ( emphasisLine < rangeObject . endLineNumber ) {
239
+ const afterRange = new Range ( emphasisLine + 1 , 1 , range . endLineNumber , 1 ) ;
240
+ commentingRangeDecorations . push ( new CommentingRangeDecoration ( editor , info . owner , info . extensionId , info . label , afterRange , this . decorationOptions , info . commentingRanges , true ) ) ;
241
+ }
238
242
} else {
239
243
commentingRangeDecorations . push ( new CommentingRangeDecoration ( editor , info . owner , info . extensionId , info . label , range , this . decorationOptions , info . commentingRanges ) ) ;
240
244
}
@@ -702,7 +706,7 @@ export class CommentController implements IEditorContribution {
702
706
if ( matchedLineNumber === null || ! e . target . element ) {
703
707
return ;
704
708
}
705
- const mouseUpIsOnDecorator = ( e . target . element . className . indexOf ( 'comment-diff-added ' ) >= 0 ) ;
709
+ const mouseUpIsOnDecorator = ( e . target . element . className . indexOf ( 'comment-range-glyph ' ) >= 0 ) ;
706
710
707
711
const lineNumber = e . target . position ! . lineNumber ;
708
712
let range : Range | undefined ;
@@ -1143,15 +1147,14 @@ registerThemingParticipant((theme, collector) => {
1143
1147
const commentingRangeForeground = theme . getColor ( overviewRulerCommentingRangeForeground ) ;
1144
1148
if ( commentingRangeForeground ) {
1145
1149
collector . addRule ( `
1146
- .monaco-editor .comment-diff-added {
1147
- border-left: 3px solid ${ commentingRangeForeground } ;
1150
+ .monaco-editor .comment-diff-added,
1151
+ .monaco-editor .comment-range-glyph.multiline-add {
1152
+ border-left-color: ${ commentingRangeForeground } ;
1148
1153
}
1149
- .monaco-editor .comment-diff-added:before {
1154
+ .monaco-editor .comment-diff-added:before,
1155
+ .monaco-editor .comment-range-glyph.line-hover:before {
1150
1156
background: ${ commentingRangeForeground } ;
1151
1157
}
1152
- .monaco-editor .comment-thread {
1153
- border-left: 3px solid ${ commentingRangeForeground } ;
1154
- }
1155
1158
.monaco-editor .comment-thread:before {
1156
1159
background: ${ commentingRangeForeground } ;
1157
1160
}
0 commit comments