Skip to content

Commit

Permalink
Using highlight position percent to sort by location
Browse files Browse the repository at this point in the history
  • Loading branch information
ytaras authored Sep 26, 2024
1 parent 619013b commit 78af9e0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ export const getHighlightPoint = (patch: string | null): HighlightPoint => {
}

export const compareHighlightsInFile = (a: Highlight, b: Highlight): number => {
if (a.highlightPositionPercent != b.highlightPositionPercent) {
return a.highlightPositionPercent - b.highlightPositionPercent;
}
// get the position of the highlight in the file
const highlightPointA = getHighlightPoint(a.patch)
const highlightPointB = getHighlightPoint(b.patch)
Expand Down

0 comments on commit 78af9e0

Please sign in to comment.