Skip to content
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

Folding Range LSP support #612

Closed
wants to merge 0 commits into from

Conversation

kv9898
Copy link
Contributor

@kv9898 kv9898 commented Oct 29, 2024

It seems that the call for folding ranges has been quite a while: posit-dev/positron#18, posit-dev/positron#2924, posit-dev/positron#3822.

I was initially only thinking about adding foldable comments, but it seems that doing this will disable the existing folding for regions and curly brackets.

As you can see in the current version of my code, I'm trying to naively iterating over the lines. Is there any internal infrastructure for analysing code lines? e.g. ignore comments and \n in the end.

Additionally, this line iteration method creates an additional problem: comment sections within functions are considered the same as those outside functions, this leads problematic handling for things like this:

# level 1 comment ####       # folding starts here
foo <- function() {
  # level 1 comment ####     # folding ends here
}

Seems that we have to handle function folding and comment folding simultaneously to solve this issue.

@kv9898 kv9898 closed this Oct 30, 2024
@kv9898 kv9898 force-pushed the feature/foldable-comments branch from e3e933b to dc5b37a Compare October 30, 2024 11:36
@github-actions github-actions bot locked and limited conversation to collaborators Oct 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant