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

refactor(rome_formatter): Part 2: Comments API #3239

Merged
merged 3 commits into from
Sep 19, 2022

Conversation

MichaReiser
Copy link
Contributor

Summary

This PR is part of the Comments refactoring (#3227)

This PR includes the API changes to Comments. Comments is the main facade used by formatters and the implementation that extracts comments from a syntax tree.

Test Plan

I implemented new test for the 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 12:26
@MichaReiser MichaReiser changed the title Comments infrastructure refactor(rome_formatter): Part 2: Comments API Sep 16, 2022
@@ -18,5 +18,9 @@ schemars = { version = "0.8.10", optional = true }
rustc-hash = "1.1.0"
countme = "3.0.1"

[dev-dependencies]
rome_js_parser = { path = "../rome_js_parser"}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added these dependencies to be able to write tests inside of rome_formatter.

CommentPlacement::Dangling { node, comment } => {
self.push_dangling_comment(&node, comment)
}
CommentPlacement::Default(mut comment) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These rules are documented in CommentPlacement::Default

Base automatically changed from feat/comments-map to refactor/comments September 16, 2022 12:32
crates/rome_formatter/src/comments.rs Outdated Show resolved Hide resolved
@MichaReiser MichaReiser merged commit e9db52a into refactor/comments Sep 19, 2022
@MichaReiser MichaReiser deleted the feat/comments-api branch September 19, 2022 14:50
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.

3 participants