Skip to content

fmt: break blocks that hold blocks - #89

Merged
kryptamine merged 1 commit into
masterfrom
fmt-break-long
Nov 16, 2026
Merged

kryptamine merged 1 commit into
masterfrom
fmt-break-long

Conversation

@kryptamine

Copy link
Copy Markdown
Owner

rune fmt puts a block holding another block on lines of its own: its inside and } get lines, the blocks chained to it by else/catch too, and each arm of such a match. Short blocks without nested ones stay on one line.

let lock = try {
    fs.lock(fs.join(dir, "LOCK"))
} catch e is IOError {
    throw if e.code == "locked" { KvError { message: "{dir} is open elsewhere" } } else { e }
};
  • rune.Parse returns Braces: which { open a block and which a match body; tokens alone cannot tell if p is Point { x: 0 } { apart.
  • Examples reformatted; fmt golden and getting-started updated.

…s chained by else or catch and the arms of such a match; the parser tells the formatter which braces open blocks
@kryptamine
kryptamine merged commit cac4012 into master Nov 16, 2026
3 checks passed
@kryptamine
kryptamine deleted the fmt-break-long branch November 16, 2026 19:16
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.

1 participant