Skip to content

feat(formatter): hug trailing closures - #332

Merged
akonwi merged 1 commit into
mainfrom
feat/formatter-hug-trailing-closures
Jul 21, 2026
Merged

feat(formatter): hug trailing closures#332
akonwi merged 1 commit into
mainfrom
feat/formatter-hug-trailing-closures

Conversation

@akonwi

@akonwi akonwi commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • keep a final multiline anonymous function attached to the call opening line when it fits
  • retain the existing fully expanded call layout as the fallback
  • make width-sensitive document choices account for enclosing indentation
  • preserve expression documents until final rendering so nested groups see their actual context

Example

router.get("/fixtures/:id/outlook", fn(r: dram::Request, w: mut dram::Response) {
  handle_outlook(a, w, r)
})

The formatter falls back to one argument per line when the opening line exceeds 100 columns, a preceding argument is multiline, argument comments are present, or the final argument is not a nonempty anonymous function.

Validation

  • cd compiler && go test ./formatter -count=1
  • cd compiler && go test ./... -count=1
  • formatted temporary copies of ../maestro/server/analysis.ard and ../dram/examples/hello/main.ard
  • git diff --check

@vercel

vercel Bot commented Jul 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ard-lang-dev Ready Ready Preview, Comment Jul 21, 2026 2:24am

@akonwi
akonwi merged commit 5494a6b into main Jul 21, 2026
6 checks passed
@akonwi
akonwi deleted the feat/formatter-hug-trailing-closures branch July 21, 2026 02:26
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