Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

feature(formatter): LineSuffixBoundary and ExpandParent IR #2590

Merged
merged 4 commits into from
May 18, 2022

Conversation

MichaReiser
Copy link
Contributor

@MichaReiser MichaReiser commented May 17, 2022

Summary

This PR introduces two new IR elements:

  • LineSuffixBoundary: Forces the printer to flush any pending LineSuffix. For example necessary to avoid a comment inside of a JSX expression accidentally getting pushed into the content of an outer element.
  • ExpandParent: Forces the parent group to be printed as expended. E.g. should allow us to remove the LineSuffix special case inside of the printer by emitting a ExpandParent for each block comment.

Part of #2579

Test Plan

I added examples with integration tests for each new IR element

@MichaReiser MichaReiser force-pushed the refactor/formatter-line-suffix branch from 75a0f62 to c990b50 Compare May 17, 2022 15:57
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented May 17, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8a70099
Status:⚡️  Build in progress...

View logs

@MichaReiser MichaReiser force-pushed the refactor/formatter-line-suffix branch 4 times, most recently from 3cfe3a3 to 058764c Compare May 17, 2022 20:17
@MichaReiser MichaReiser marked this pull request as ready for review May 17, 2022 20:17
@MichaReiser MichaReiser mentioned this pull request May 17, 2022
10 tasks
Base automatically changed from refactor/printer-try-flat-to-fits to main May 18, 2022 08:23
@MichaReiser MichaReiser force-pushed the refactor/formatter-line-suffix branch from 9aa2eff to b463a05 Compare May 18, 2022 08:39
@MichaReiser MichaReiser temporarily deployed to aws May 18, 2022 08:39 Inactive
@github-actions
Copy link

Parser conformance results on ubuntu-latest

js/262

Test result main count This PR count Difference
Total 45878 45878 0
Passed 44938 44938 0
Failed 940 940 0
Panics 0 0 0
Coverage 97.95% 97.95% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 39 39 0
Passed 36 36 0
Failed 3 3 0
Panics 0 0 0
Coverage 92.31% 92.31% 0.00%

ts/babel

Test result main count This PR count Difference
Total 588 588 0
Passed 519 519 0
Failed 69 69 0
Panics 0 0 0
Coverage 88.27% 88.27% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 16257 16257 0
Passed 12391 12391 0
Failed 3866 3866 0
Panics 0 0 0
Coverage 76.22% 76.22% 0.00%

@github-actions
Copy link

github-actions bot commented May 18, 2022

@MichaReiser MichaReiser force-pushed the refactor/formatter-line-suffix branch from b463a05 to 64fd3e0 Compare May 18, 2022 08:44
@MichaReiser MichaReiser temporarily deployed to aws May 18, 2022 08:44 Inactive
Use the `LineSuffixBoundary` for comments instead of having a special case for `LineSuffix` in flat mode.
@MichaReiser MichaReiser force-pushed the refactor/formatter-line-suffix branch from 64fd3e0 to c1b267a Compare May 18, 2022 09:05
@MichaReiser MichaReiser temporarily deployed to aws May 18, 2022 09:05 Inactive
@MichaReiser MichaReiser temporarily deployed to aws May 18, 2022 09:07 Inactive
@MichaReiser MichaReiser force-pushed the refactor/formatter-line-suffix branch from 00d54f1 to 8a70099 Compare May 18, 2022 09:08
@MichaReiser MichaReiser temporarily deployed to aws May 18, 2022 09:08 Inactive
@MichaReiser MichaReiser merged commit df38024 into main May 18, 2022
@MichaReiser MichaReiser deleted the refactor/formatter-line-suffix branch May 18, 2022 09:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants