Fix ranges of comment sections #855
Open
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.
Addresses #846.
Addresses posit-dev/positron#6137
Supersedes and closes #854.
Pair-programmed with an agent ✨.
The first commit refactors things to avoid the use of explicit stacks. The second commit is the fix.
Both linked issues stem from section ranges not extending to the section end. The section now ends at either the next non-nested section, or at the closing delimiter of the enclosing node (when the section is nested in a function for instance
The section end needs to be on the previous line. In principle range ends are exclusive, but in practice we need to go back a line for vscode breadcrumbs coverages to behave properly.
QA Notes
The fixes in this PR are tested on the backend side. On the frontend side you should see the following when testing:
With:
The breadcrumbs coverage (revealed when a breadcrumb is selected) should be consistent with the sections. Nested symbols such as function definitions should work as well.
Screen.Recording.2025-06-26.at.14.07.45.mov
With:
The breadcrumb sticky scrolls should incorporate sections. Nested breadcrumb should still work:
Screen.Recording.2025-06-26.at.14.08.10.mov