mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-21 12:05:10 +00:00
Accept any Into<AnyNodeRef>
as Comments
arguments (#5205)
This commit is contained in:
parent
6f7d3cc798
commit
b369288833
9 changed files with 73 additions and 41 deletions
|
@ -1,3 +1,7 @@
|
|||
use crate::comments::{
|
||||
dangling_node_comments, leading_node_comments, trailing_node_comments, Comments,
|
||||
};
|
||||
use crate::context::PyFormatContext;
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use ruff_formatter::prelude::*;
|
||||
use ruff_formatter::{format, write};
|
||||
|
@ -10,11 +14,6 @@ use rustpython_parser::lexer::lex;
|
|||
use rustpython_parser::{parse_tokens, Mode};
|
||||
use std::borrow::Cow;
|
||||
|
||||
use crate::comments::{
|
||||
dangling_node_comments, leading_node_comments, trailing_node_comments, Comments,
|
||||
};
|
||||
use crate::context::PyFormatContext;
|
||||
|
||||
pub(crate) mod builders;
|
||||
pub mod cli;
|
||||
mod comments;
|
||||
|
@ -437,9 +436,10 @@ def with_leading_comment(): ...
|
|||
// Uncomment the `dbg` to print the IR.
|
||||
// Use `dbg_write!(f, []) instead of `write!(f, [])` in your formatting code to print some IR
|
||||
// inside of a `Format` implementation
|
||||
// dbg!(formatted
|
||||
// use ruff_formatter::FormatContext;
|
||||
// formatted
|
||||
// .document()
|
||||
// .display(formatted.context().source_code()));
|
||||
// .display(formatted.context().source_code());
|
||||
|
||||
// dbg!(formatted
|
||||
// .context()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue