Skip to content

Add newlines around function bodies#649

Open
fyc09 wants to merge 2 commits into
peggyjs:mainfrom
fyc09:fix-format
Open

Add newlines around function bodies#649
fyc09 wants to merge 2 commits into
peggyjs:mainfrom
fyc09:fix-format

Conversation

@fyc09
Copy link
Copy Markdown

@fyc09 fyc09 commented Aug 8, 2025

A BORING problem:

Currently, the generater creates code like following.

  function peg$f21() {    return '';  }

There is no newlines around body, but statements inside are indented. This seems like a mistake. Adding the newlines will make the code looks like:

  function peg$f21() {
    return '';
  }

@fyc09 fyc09 changed the title Add newlines around function bodys Add newlines around function bodies Aug 19, 2025
@hildjj
Copy link
Copy Markdown
Contributor

hildjj commented Dec 16, 2025

This would need several tests, particularly around sourcemaps. It should also not add newlines for blocks that already have them:

foo = "a" {
  return "b";
}

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.48%. Comparing base (2c11061) to head (809ff95).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #649   +/-   ##
=======================================
  Coverage   99.48%   99.48%           
=======================================
  Files          34       34           
  Lines        4313     4313           
=======================================
  Hits         4291     4291           
  Misses         22       22           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

3 participants