Highlight comment range
Change-Id: If6744a210b4fd40a159b201543d79794970ccfd3
diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.ts b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.ts
index 7c32bf7..3fb1a50 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.ts
@@ -179,6 +179,10 @@
@property({type: Array})
_commentRanges: CommentRangeLayer[] = [];
+ // explicitly highlight a range if it is not associated with any comment
+ @property({type: Object})
+ highlightRange?: CommentRange;
+
@property({type: Array})
coverageRanges: CoverageRange[] = [];
@@ -419,6 +423,14 @@
if (addedCommentRanges && addedCommentRanges.length) {
this.push('_commentRanges', ...addedCommentRanges);
}
+ if (this.highlightRange) {
+ this.push('_commentRanges', {
+ side: Side.RIGHT,
+ range: this.highlightRange,
+ hovering: true,
+ rootId: '',
+ });
+ }
}
/**
diff --git a/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread.ts b/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread.ts
index 1af2adf..ec7be4a 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread.ts
+++ b/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread.ts
@@ -317,6 +317,10 @@
return GerritNav.getUrlForComment(changeNum, projectName, id);
}
+ getHighlightRange() {
+ return this.comments?.[0]?.range;
+ }
+
_getDiffUrlForComment(
projectName?: RepoName,
changeNum?: NumericChangeId,
diff --git a/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread_html.ts b/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread_html.ts
index 7d5ba11..dfb0d45 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread_html.ts
+++ b/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread_html.ts
@@ -191,6 +191,7 @@
path="[[path]]"
prefs="[[_prefs]]"
render-prefs="[[_renderPrefs]]"
+ highlight-range="[[getHighlightRange(comments)]]"
>
</gr-diff>
</template>