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

refactor(rome_formatter): Part 5: Comments formatting #3243

Merged
merged 4 commits into from
Sep 20, 2022

Conversation

MichaReiser
Copy link
Contributor

Summary

This PR is part of the comments refactoring #3227.

  • It removes the old builders for formatting the leading and trailing token trivia and introduces new builders to format the leading, dangling, and trailing node comments.
  • Introduces a new soft_line_indent_or_spaced builder that replaces format_delimited(..).soft_block_or_spaces()
  • Deletes the no longer needed GroupsElementsBuffer (yay)
  • Removes any (release) state from FormatState as it is no longer necessary to track the last token to know if spaces must be inserted between the last token and comments (is now the responsibility of the formatter that calls format_dangling_comments).

Test Plan

Added a doc test for the new soft_line_indent_or_spaced builder.

@MichaReiser MichaReiser added the A-Formatter Area: formatter label Sep 16, 2022
@MichaReiser MichaReiser added this to the 0.10.0 milestone Sep 16, 2022
@MichaReiser MichaReiser requested a review from a team September 16, 2022 15:24
@MichaReiser MichaReiser force-pushed the refactor/move-verbatim-to-formatter branch from 36e4367 to be56d34 Compare September 16, 2022 15:24
crates/rome_formatter/src/builders.rs Outdated Show resolved Hide resolved
Base automatically changed from refactor/move-verbatim-to-formatter to refactor/comments September 19, 2022 14:51
@MichaReiser MichaReiser merged commit a5bf727 into refactor/comments Sep 20, 2022
@MichaReiser MichaReiser deleted the refactor/comments-formatting branch September 20, 2022 12:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Formatter Area: formatter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants