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

refactor(rome_formatter): Format leading/trailing node comments with most outer node #2782

Closed
wants to merge 6 commits into from

Conversation

MichaReiser
Copy link
Contributor

Summary

This PR isn't ready yet. It considerably regresses performance and there are still a few instabilities when it comes to formatting comments. But it tries to address the first issue described in #2768 by formatting leading/trailing comments at the start/end of a node with the most outer node rather than the token.

I mainly want to put this up in case you hit any more instability issues while I'm on PTO and need an urgent fix. This should then be a good starting point.

CC: @leops @yassere @ematipico

Test Plan

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.
@cloudflare-workers-and-pages
Copy link

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

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: b014966
Status: ✅  Deploy successful!
Preview URL: https://3b5c9ecc.tools-8rn.pages.dev
Branch Preview URL: https://refactor-line-suffix-comment.tools-8rn.pages.dev

View logs

@sebmck sebmck deleted the refactor/line-suffix-comments-v2 branch November 4, 2022 20:37
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.

1 participant