mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 05:15:12 +00:00
Track formatted comments (#4979)
This commit is contained in:
parent
646ab64850
commit
68d52da43b
6 changed files with 60 additions and 85 deletions
|
@ -206,32 +206,26 @@ break;
|
|||
|
||||
comments_map.push_leading(
|
||||
continue_statement.as_ref().into(),
|
||||
SourceComment {
|
||||
slice: source_code.slice(TextRange::at(TextSize::new(0), TextSize::new(17))),
|
||||
#[cfg(debug_assertions)]
|
||||
formatted: std::cell::Cell::new(false),
|
||||
position: CommentTextPosition::OwnLine,
|
||||
},
|
||||
SourceComment::new(
|
||||
source_code.slice(TextRange::at(TextSize::new(0), TextSize::new(17))),
|
||||
CommentTextPosition::OwnLine,
|
||||
),
|
||||
);
|
||||
|
||||
comments_map.push_trailing(
|
||||
continue_statement.as_ref().into(),
|
||||
SourceComment {
|
||||
slice: source_code.slice(TextRange::at(TextSize::new(28), TextSize::new(10))),
|
||||
#[cfg(debug_assertions)]
|
||||
formatted: std::cell::Cell::new(false),
|
||||
position: CommentTextPosition::EndOfLine,
|
||||
},
|
||||
SourceComment::new(
|
||||
source_code.slice(TextRange::at(TextSize::new(28), TextSize::new(10))),
|
||||
CommentTextPosition::EndOfLine,
|
||||
),
|
||||
);
|
||||
|
||||
comments_map.push_leading(
|
||||
break_statement.as_ref().into(),
|
||||
SourceComment {
|
||||
slice: source_code.slice(TextRange::at(TextSize::new(39), TextSize::new(15))),
|
||||
#[cfg(debug_assertions)]
|
||||
formatted: std::cell::Cell::new(false),
|
||||
position: CommentTextPosition::OwnLine,
|
||||
},
|
||||
SourceComment::new(
|
||||
source_code.slice(TextRange::at(TextSize::new(39), TextSize::new(15))),
|
||||
CommentTextPosition::OwnLine,
|
||||
),
|
||||
);
|
||||
|
||||
let comments = Comments::new(comments_map);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue