Repository navigation
Keep a block's brackets when its folds merge by lines - #100
Merged
Merged
Conversation
A block holding one statement folds twice over the same lines: the block from the shared query, with its opener and closer, and the statement from the context query, with none. merge_by_lines kept the innermost node's syntax, the statement's None, so the fold lost its brackets and frontends drew no rail for it, as for every one-statement `for` body. The merged fold now keeps the merged node's opener and closer when its own node has none. AI-assisted: Claude Code. Agent-Session: 3c0a7f53-4e2b-4d6b-b99f-471c7e752571
sidkmenon
force-pushed
the
fold-merge-keeps-syntax
branch
from
October 7, 2026 11:30
f763846 to
addbc3b
Compare
Merged
sidkmenon
added this pull request to stack #101
October 7, 2026 11:32
sidkmenon
marked this pull request as ready for review
October 7, 2026 11:34
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.
Changes what diffr emits: more folds carry
syntax. No schema change; draft until the output change is reviewed.A block holding one statement folds twice over the same lines: the block (shared query, with
@fold.open/@fold.close) and the statement (context query, no opener).merge_by_lineskeeps the innermost node's syntax, which is the statement'sNone, so the merged fold lost its brackets. Frontends draw rails and bracket highlights fromsyntax, so every one-statementfor/ifbody had no rail. The merged fold now keeps the other node's opener and closer when its own node has none; range, indent, owner and pairing are unchanged.Seen in
reviewStructuralDiff.ts(review @ 38a74d5fe): theforbodies at lines 119, 123 and 124 now carry syntax.Validation:
cargo test --workspacepasses;cargo fmt --checkclean. Extendedtwo_queries_folding_the_same_lines_make_one_foldto assert the merged fold keeps the block's braces; it fails without the fix.AI assistance: written with Claude Code.