Skip to content

Add bracket-pair folding for maps, lists, tuples, and binaries#56

Merged
JesseHerrick merged 1 commit intomainfrom
add-bracket-pair-folding
May 6, 2026
Merged

Add bracket-pair folding for maps, lists, tuples, and binaries#56
JesseHerrick merged 1 commit intomainfrom
add-bracket-pair-folding

Conversation

@tessi
Copy link
Copy Markdown
Member

@tessi tessi commented May 4, 2026

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.

before after
screen-recording-2026-05-04 screen-recording-2026-05-04-1156

Note

Low Risk
Low risk: scoped to FoldingRanges output generation and covered by new unit tests; main risk is minor behavior changes in editors due to additional fold regions.

Overview
Extends FoldingRanges to emit fold regions for multi-line bracket pairs ({}, [], (), <<>>) in addition to existing heredoc and do/fn..end folding.

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.

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>
@tessi tessi requested a review from JesseHerrick May 4, 2026 10:09
Copy link
Copy Markdown
Member

@JesseHerrick JesseHerrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful change! Thank you very much for the contribution @tessi! We'll ship this in the next release.

@JesseHerrick JesseHerrick merged commit ecda0a8 into main May 6, 2026
5 checks passed
@JesseHerrick JesseHerrick deleted the add-bracket-pair-folding branch May 6, 2026 05:38
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