Add bracket-pair folding for maps, lists, tuples, and binaries#56
Merged
JesseHerrick merged 1 commit intomainfrom May 6, 2026
Merged
Add bracket-pair folding for maps, lists, tuples, and binaries#56JesseHerrick merged 1 commit intomainfrom
JesseHerrick merged 1 commit intomainfrom
Conversation
Extends FoldingRanges to emit ranges for multi-line `{...}`, `[...]`,
`(...)`, and `<<...>>` in addition to the existing heredoc and
`do/fn..end` support. Uses the existing parser tokens
(TokOpenBrace/TokCloseBrace etc.), so brackets inside strings, comments,
sigils, char literals, and atoms are skipped automatically.
Without this, editors cannot fold multi-line maps, lists, tuples,
function-call argument blocks, or binaries even though they fold
function bodies, because the LSP advertises FoldingRangeProvider and
suppresses the editor's indentation-based fallback.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
JesseHerrick
approved these changes
May 6, 2026
Member
JesseHerrick
left a comment
There was a problem hiding this comment.
Wonderful change! Thank you very much for the contribution @tessi! We'll ship this in the next release.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Extends FoldingRanges to emit ranges for multi-line
{...},[...],(...), and<<...>>in addition to the existing heredoc anddo/fn..endsupport. Uses the existing parser tokens (TokOpenBrace/TokCloseBrace etc.), so brackets inside strings, comments, sigils, char literals, and atoms are skipped automatically.Note
Low Risk
Low risk: scoped to
FoldingRangesoutput generation and covered by new unit tests; main risk is minor behavior changes in editors due to additional fold regions.Overview
Extends
FoldingRangesto emit fold regions for multi-line bracket pairs ({},[],(),<<>>) in addition to existing heredoc anddo/fn..endfolding.Adds a shared folding test helper and a comprehensive new test suite covering nested containers, heredoc interactions, and ensuring brackets in strings/comments don’t create folds.
Reviewed by Cursor Bugbot for commit 0d4ba23. Bugbot is set up for automated code reviews on this repo. Configure here.