Skip to content

Fix ranges of comment sections #855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

lionel-
Copy link
Contributor

@lionel- lionel- commented Jun 26, 2025

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:

# https://github.com/posit-dev/ark/issues/846

{
    # level 1 ####
    1
    # another level 1 ####
    2
}

# Level ----

foo <- function() {
    1
    2
}

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:

# https://github.com/posit-dev/positron/issues/6137

test_fun <- function(...) {












    return(invisible())
  }





  #### Section Title ####
  test_fun2 <- function(...) {







    fun3 <- function() {











    }







    # long function
    return(invisible())
  }

The breadcrumb sticky scrolls should incorporate sections. Nested breadcrumb should still work:

Screen.Recording.2025-06-26.at.14.08.10.mov

@lionel- lionel- force-pushed the bugfix/section-symbols branch from 74dbe94 to a5b9485 Compare June 30, 2025 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant