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

Commit

Permalink
Keep trailing comments with parenthesized node
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser committed Sep 15, 2022
1 parent 50b9832 commit 46c5ac1
Show file tree
Hide file tree
Showing 8 changed files with 439 additions and 867 deletions.
10 changes: 7 additions & 3 deletions crates/rome_formatter/src/comments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod builder;
mod map;

use self::{builder::CommentsBuilderVisitor, map::CommentsMap};
use crate::TextSize;
use crate::{TextSize, TransformSourceMap};
use rome_rowan::syntax::SyntaxElementKey;
use rome_rowan::{Language, SyntaxNode, SyntaxToken, SyntaxTriviaPieceComments};
use rustc_hash::FxHashSet;
Expand Down Expand Up @@ -340,11 +340,15 @@ pub struct Comments<L: Language> {

impl<L: Language> Comments<L> {
/// Extracts all the suppressions from `root` and its child nodes.
pub fn from_node<Style>(root: &SyntaxNode<L>, style: &Style) -> Self
pub fn from_node<Style>(
root: &SyntaxNode<L>,
style: &Style,
source_map: Option<&TransformSourceMap>,
) -> Self
where
Style: CommentStyle<Language = L>,
{
let builder = CommentsBuilderVisitor::new(style);
let builder = CommentsBuilderVisitor::new(style, source_map);

let (comments, skipped) = builder.visit(root);

Expand Down
Loading

0 comments on commit 46c5ac1

Please sign in to comment.