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

refactor(rome_formatter): Unify comment/token spacing for leading/tra… #2766

Merged
merged 4 commits into from
Jun 23, 2022

Conversation

MichaReiser
Copy link
Contributor

Summary

refactor(rome_formatter): Implement CommentStyle on FormatContext

This is a small refactor that implements CommentStyle on FormatContext to avoid the additional S type parameter for all token builders.

This PR further simplifies the spacing handling between comments and tokens by fully delegating the spacing handling from the comments formatting to when a token gets formatted. This simplifies the overall logic.

Test Plan

cargo test. This PR isn't adding any new functionality

@MichaReiser MichaReiser temporarily deployed to aws June 23, 2022 09:49 Inactive
This is a small refactor that implements `CommentStyle` on `FormatContext` to avoid the additional `S` type parameter for all token builders.

This PR further simplifies the spacing handling between comments and tokens by fully delegating the spacing handling from the comments formatting to when a token gets formatted. This simplifies the overall logic.
@MichaReiser MichaReiser force-pushed the refactor/comment-style-on-context branch from 6e3bdb0 to ed3abda Compare June 23, 2022 09:51
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jun 23, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: a48068d
Status:⚡️  Build in progress...

View logs

@MichaReiser MichaReiser temporarily deployed to aws June 23, 2022 09:51 Inactive
@github-actions
Copy link

github-actions bot commented Jun 23, 2022

@MichaReiser MichaReiser marked this pull request as draft June 23, 2022 10:36
@MichaReiser MichaReiser temporarily deployed to aws June 23, 2022 10:44 Inactive
@MichaReiser MichaReiser marked this pull request as ready for review June 23, 2022 10:44
crates/rome_formatter/src/token.rs Outdated Show resolved Hide resolved
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
@MichaReiser MichaReiser temporarily deployed to aws June 23, 2022 11:59 Inactive
@MichaReiser MichaReiser merged commit 071698b into main Jun 23, 2022
@MichaReiser MichaReiser deleted the refactor/comment-style-on-context branch June 23, 2022 12:03
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