mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 02:38:25 +00:00
playground: Add AST/Tokens/Formatter panels (#5859)
This commit is contained in:
parent
9ed7ceeb0a
commit
46a17d11f3
19 changed files with 1343 additions and 780 deletions
|
@ -38,7 +38,7 @@ mod source_code;
|
|||
use crate::formatter::Formatter;
|
||||
use crate::group_id::UniqueGroupIdBuilder;
|
||||
use crate::prelude::TagKind;
|
||||
use std::fmt::Debug;
|
||||
use std::fmt::{Debug, Display};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::format_element::document::Document;
|
||||
|
@ -331,6 +331,16 @@ where
|
|||
Ok(printed)
|
||||
}
|
||||
}
|
||||
|
||||
impl<Context> Display for Formatted<Context>
|
||||
where
|
||||
Context: FormatContext,
|
||||
{
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
std::fmt::Display::fmt(&self.document.display(self.context.source_code()), f)
|
||||
}
|
||||
}
|
||||
|
||||
pub type PrintResult<T> = Result<T, PrintError>;
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue