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

Commit

Permalink
Merge branch 'refactor/comments-infrastructure' into feat/assert-comm…
Browse files Browse the repository at this point in the history
…ents-formatting
  • Loading branch information
MichaReiser committed Sep 20, 2022
2 parents 8107311 + beb55c1 commit c568991
Show file tree
Hide file tree
Showing 128 changed files with 7,939 additions and 1,022 deletions.
1 change: 1 addition & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ bench_analyzer = "run -p xtask_bench --release -- --feature analyzer"
coverage = "run -p xtask_coverage --profile=release-with-debug --"
rome-cli = "run -p rome_cli --release --"
rome-cli-dev = "run -p rome_cli --"
contributors = "run -p xtask_contributors --"

[profile.release]
lto = true
30 changes: 30 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ members = [
"xtask/coverage",
"xtask/lintdoc",
"xtask/libs_bench",
"xtask/contributors",
]

[profile.release-with-debug]
Expand Down
1 change: 1 addition & 0 deletions crates/rome_formatter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ countme = "3.0.1"
[dev-dependencies]
rome_js_parser = { path = "../rome_js_parser"}
rome_js_syntax = { path = "../rome_js_syntax" }
rome_diagnostics = { path = "../rome_diagnostics" }

[features]
serde = ["dep:serde", "schemars", "rome_rowan/serde"]
8 changes: 4 additions & 4 deletions crates/rome_formatter/src/comments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ pub struct DecoratedComment<L: Language> {
enclosing: SyntaxNode<L>,
preceding: Option<SyntaxNode<L>>,
following: Option<SyntaxNode<L>>,
following_token: SyntaxToken<L>,
following_token: Option<SyntaxToken<L>>,
text_position: CommentTextPosition,
lines_before: u32,
lines_after: u32,
Expand Down Expand Up @@ -379,7 +379,7 @@ impl<L: Language> DecoratedComment<L> {
self.following.take()
}

/// The number of lines between this comment and the **previous** token or comment.
/// The number of line breaks between this comment and the **previous** token or comment.
///
/// # Examples
///
Expand Down Expand Up @@ -448,8 +448,8 @@ impl<L: Language> DecoratedComment<L> {
/// ```
///
/// The `following_token` for both comments is `b` because it's the token coming after the comments.
pub fn following_token(&self) -> &SyntaxToken<L> {
&self.following_token
pub fn following_token(&self) -> Option<&SyntaxToken<L>> {
self.following_token.as_ref()
}
}

Expand Down
Loading

0 comments on commit c568991

Please sign in to comment.