mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-23 04:55:09 +00:00
Call pattern formatting (#6594)
This commit is contained in:
parent
9bf6713b76
commit
897cce83b3
22 changed files with 473 additions and 330 deletions
|
@ -152,40 +152,6 @@ pub fn format_node<'a>(
|
|||
Ok(formatted)
|
||||
}
|
||||
|
||||
pub(crate) struct NotYetImplemented<'a>(AnyNodeRef<'a>);
|
||||
|
||||
/// Formats a placeholder for nodes that have not yet been implemented
|
||||
pub(crate) fn not_yet_implemented<'a, T>(node: T) -> NotYetImplemented<'a>
|
||||
where
|
||||
T: Into<AnyNodeRef<'a>>,
|
||||
{
|
||||
NotYetImplemented(node.into())
|
||||
}
|
||||
|
||||
impl Format<PyFormatContext<'_>> for NotYetImplemented<'_> {
|
||||
fn fmt(&self, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
let text = std::format!("NOT_YET_IMPLEMENTED_{:?}", self.0.kind());
|
||||
|
||||
f.write_element(FormatElement::Tag(Tag::StartVerbatim(
|
||||
tag::VerbatimKind::Verbatim {
|
||||
length: text.text_len(),
|
||||
},
|
||||
)))?;
|
||||
|
||||
f.write_element(FormatElement::DynamicText {
|
||||
text: Box::from(text),
|
||||
})?;
|
||||
|
||||
f.write_element(FormatElement::Tag(Tag::EndVerbatim))?;
|
||||
|
||||
f.context()
|
||||
.comments()
|
||||
.mark_verbatim_node_comments_formatted(self.0);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct NotYetImplementedCustomText<'a> {
|
||||
text: &'static str,
|
||||
node: AnyNodeRef<'a>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue