fix: order mermaid diagram comments by document position - #239
Merged
Conversation
Element anchors (mermaid diagrams) always resolve with a null range by design, so the sidebar comparator sank every diagram comment below all resolved text comments, and navigation excluded them from prev/next and the "Comment X of Y" counter. Collapse compareResolvedThreads to pure source-document ordering using the required sourceLines on both anchor kinds, and switch navigation eligibility from the range proxy to the semantic unresolved field so resolved element threads become navigable. Fixes #238
blimmer
commented
Jul 9, 2026
| ]; | ||
| } | ||
|
|
||
| // Source lines are the one position every anchor kind shares — element anchors never resolve to a DOM Range. |
Contributor
Author
There was a problem hiding this comment.
This actually get a bit less complicated with this fix
| expect(annotated.hovered).toBe(annotated.resting); | ||
| }); | ||
|
|
||
| it('orders the sidebar by document position when a diagram comment precedes a text comment', async () => { |
blimmer
marked this pull request as ready for review
July 9, 2026 18:58
jcarver989
approved these changes
Jul 10, 2026
blimmer
pushed a commit
that referenced
this pull request
Jul 10, 2026
🤖 I have created a release *beep* *boop* --- ## [0.9.3](v0.9.2...v0.9.3) (2026-07-10) ### Bug Fixes * order mermaid diagram comments by document position ([#239](#239)) ([a4487d7](a4487d7)) * restore automatic plan approval on Claude Code 2.1.199+ ([#235](#235)) ([9fe93d8](9fe93d8)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: contextbridge-pr-automation[bot] <259134118+contextbridge-pr-automation[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Comments anchored to mermaid diagram elements always sank to the bottom of the comments sidebar and were skipped by prev/next navigation and the "Comment X of Y" counter, because
thread.rangedoubled as the ordering and navigation-eligibility signal — and element anchors never resolve to a DOM Range by design. Sidebar ordering now uses the stored anchor's source lines (the one position every anchor kind shares), and navigation eligibility keys off the semanticunresolvedfield. Closes #238.Review focus
Commits
89b4452— fix: order mermaid diagram comments by document position