feat: nesting rules for range annotations #130

Open
noe.trevino wants to merge 8 commits from feature-108/nesting-rules into feature-108/render-helper
Owner

Stacked on #129. Retarget to the umbrella (#127) once #128 and #129 merge.

  • add the nesting rules doc (docs/visual-annotations/priority.md)
  • add get_innermost_bookmark (one synced pass); ties go single, then smaller range, then older
  • get_bookmark_at_line uses the same tie-break
  • annotate uses "starts on": edits there, else creates (even inside a range)
  • a selection over an existing start line resizes that bookmark
  • delete and toggle use "innermost"
  • hooks get the bookmark's line, not the cursor's
  • fix: picker edit goes by id (annotate_by_id), so stacked start lines edit the right one
  • fix: a failed delete puts the bookmark back at its old index

Calls to look at:

  • a one-line selection on a range's start shrinks it to a single

  • the update hook doesn't carry the old/new end_line yet

  • one test per row of the doc's cases table

  • note-only edits keep the extmark, so undo still restores a range

  • tests pass (606)

  • retarget to the umbrella after #128 and #129

Refs #108

Stacked on #129. Retarget to the umbrella (#127) once #128 and #129 merge. - add the nesting rules doc (`docs/visual-annotations/priority.md`) - add `get_innermost_bookmark` (one synced pass); ties go single, then smaller range, then older - `get_bookmark_at_line` uses the same tie-break - annotate uses "starts on": edits there, else creates (even inside a range) - a selection over an existing start line resizes that bookmark - delete and toggle use "innermost" - hooks get the bookmark's line, not the cursor's - fix: picker edit goes by id (`annotate_by_id`), so stacked start lines edit the right one - fix: a failed delete puts the bookmark back at its old index Calls to look at: - a one-line selection on a range's start shrinks it to a single - the update hook doesn't carry the old/new `end_line` yet - [x] one test per row of the doc's cases table - [x] note-only edits keep the extmark, so undo still restores a range - [x] tests pass (606) - [ ] retarget to the umbrella after #128 and #129 Refs #108
Refs #108
- add get_innermost_bookmark
- break ties: single, then smaller range, then older
- make get_bookmark_at_line use the same tie-break

Refs #108
- resize the bookmark starting on the range's first line instead of creating one
- re-render its tracking extmark so the new end is tracked
- roll back end_line and note when the save fails
- draw the note and emit the update at the bookmark's own line

Refs #108
feat(api): delete and toggle the innermost bookmark
All checks were successful
Auto Assign / assign (pull_request_target) Successful in 2s
CI / stylua (pull_request) Successful in 5s
CI / config (pull_request) Successful in 5s
CI / Check for debug messages (pull_request) Successful in 5s
CI / tests (pull_request) Successful in 17s
CI / docs (pull_request) Has been skipped
CI / release (pull_request) Has been skipped
CI / ci (pull_request) Successful in 0s
02459ce5ca
- look up delete and toggle_annotation with get_innermost_bookmark
- draw a toggled note on the bookmark's own line
- emit delete and toggle hooks with the bookmark's line

Refs #108
noe.trevino force-pushed feature-108/nesting-rules from 02459ce5ca
All checks were successful
Auto Assign / assign (pull_request_target) Successful in 2s
CI / stylua (pull_request) Successful in 5s
CI / config (pull_request) Successful in 5s
CI / Check for debug messages (pull_request) Successful in 5s
CI / tests (pull_request) Successful in 17s
CI / docs (pull_request) Has been skipped
CI / release (pull_request) Has been skipped
CI / ci (pull_request) Successful in 0s
to ecad5b8abf
All checks were successful
CI / config (pull_request) Successful in 3s
CI / stylua (pull_request) Successful in 4s
CI / Check for debug messages (pull_request) Successful in 3s
CI / docs (pull_request) Has been skipped
CI / tests (pull_request) Successful in 17s
CI / release (pull_request) Has been skipped
CI / ci (pull_request) Successful in 0s
2026-10-13 17:34:39 -05:00
Compare
All checks were successful
CI / config (pull_request) Successful in 3s
CI / stylua (pull_request) Successful in 4s
CI / Check for debug messages (pull_request) Successful in 3s
CI / docs (pull_request) Has been skipped
CI / tests (pull_request) Successful in 17s
CI / release (pull_request) Has been skipped
CI / ci (pull_request) Successful in 0s
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feature-108/nesting-rules:feature-108/nesting-rules
git switch feature-108/nesting-rules

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch feature-108/render-helper
git merge --no-ff feature-108/nesting-rules
git switch feature-108/nesting-rules
git rebase feature-108/render-helper
git switch feature-108/render-helper
git merge --ff-only feature-108/nesting-rules
git switch feature-108/nesting-rules
git rebase feature-108/render-helper
git switch feature-108/render-helper
git merge --no-ff feature-108/nesting-rules
git switch feature-108/render-helper
git merge --squash feature-108/nesting-rules
git switch feature-108/render-helper
git merge --ff-only feature-108/nesting-rules
git switch feature-108/render-helper
git merge feature-108/nesting-rules
git push origin feature-108/render-helper
Sign in to join this conversation.
No description provided.