Skip to content

Commit 20c950a

Browse files
authored
Fix another comment decoration transparency issue (microsoft#158607)
1 parent 78cd55a commit 20c950a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ class CommentingRangeDecorator {
185185
this._doUpdate(editor, commentInfos);
186186
}
187187

188+
private _lineHasThread(editor: ICodeEditor, lineRange: Range) {
189+
return editor.getDecorationsInRange(lineRange)?.find(decoration => decoration.options.description === CommentGlyphWidget.description);
190+
}
191+
188192
private _doUpdate(editor: ICodeEditor, commentInfos: ICommentInfo[], emphasisLine: number = -1, selectionRange: Range | undefined = this._lastSelection) {
189193
const model = editor.getModel();
190194
if (!model) {
@@ -215,7 +219,10 @@ class CommentingRangeDecorator {
215219
intersectingSelectionRange = new Range(intersectingSelectionRange.startLineNumber, 1, intersectingSelectionRange.endLineNumber - 1, 1);
216220
}
217221
commentingRangeDecorations.push(new CommentingRangeDecoration(editor, info.owner, info.extensionId, info.label, intersectingSelectionRange, this.multilineDecorationOptions, info.commentingRanges, true));
218-
commentingRangeDecorations.push(new CommentingRangeDecoration(editor, info.owner, info.extensionId, info.label, intersectingEmphasisRange, this.hoverDecorationOptions, info.commentingRanges, true));
222+
223+
if (!this._lineHasThread(editor, intersectingEmphasisRange)) {
224+
commentingRangeDecorations.push(new CommentingRangeDecoration(editor, info.owner, info.extensionId, info.label, intersectingEmphasisRange, this.hoverDecorationOptions, info.commentingRanges, true));
225+
}
219226

220227
const beforeRangeEndLine = Math.min(intersectingEmphasisRange.startLineNumber, intersectingSelectionRange.startLineNumber) - 1;
221228
const hasBeforeRange = rangeObject.startLineNumber <= beforeRangeEndLine;
@@ -234,7 +241,10 @@ class CommentingRangeDecorator {
234241
const beforeRange = new Range(range.startLineNumber, 1, emphasisLine - 1, 1);
235242
commentingRangeDecorations.push(new CommentingRangeDecoration(editor, info.owner, info.extensionId, info.label, beforeRange, this.decorationOptions, info.commentingRanges, true));
236243
}
237-
commentingRangeDecorations.push(new CommentingRangeDecoration(editor, info.owner, info.extensionId, info.label, new Range(emphasisLine, 1, emphasisLine, 1), this.hoverDecorationOptions, info.commentingRanges, true));
244+
const emphasisRange = new Range(emphasisLine, 1, emphasisLine, 1);
245+
if (!this._lineHasThread(editor, emphasisRange)) {
246+
commentingRangeDecorations.push(new CommentingRangeDecoration(editor, info.owner, info.extensionId, info.label, emphasisRange, this.hoverDecorationOptions, info.commentingRanges, true));
247+
}
238248
if (emphasisLine < rangeObject.endLineNumber) {
239249
const afterRange = new Range(emphasisLine + 1, 1, range.endLineNumber, 1);
240250
commentingRangeDecorations.push(new CommentingRangeDecoration(editor, info.owner, info.extensionId, info.label, afterRange, this.decorationOptions, info.commentingRanges, true));

0 commit comments

Comments
 (0)