Skip to content

Add folding ranges #815

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 15 commits into
base: main
Choose a base branch
from
Open

Add folding ranges #815

wants to merge 15 commits into from

Conversation

kv9898
Copy link
Contributor

@kv9898 kv9898 commented May 28, 2025

Moving back from posit-dev/air#146.

Old description:

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 support for things like regions and brackets. Therefore, I rewrote these functionalities also.

The PR already supports the folding-range-handling of brackets, regions, code cells, indentations and nested comment sections:

(The screenshot is new, though)
image

Note that, compared to the old PR, this PR no longer relies on a naive search for brackets. Instead it uses the new tree_sitter of air to walk down the AST for node handling.

@kv9898
Copy link
Contributor Author

kv9898 commented Jun 3, 2025

are we good to go?

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.

2 participants