Track formatting all comments

We currently don't format all comments as match statements are not yet implemented. We can work around this for the top level match statement by setting them manually formatted but the mocked-out top level match doesn't call into its children so they would still have unformatted comments
This commit is contained in:
konsti 2023-08-10 09:19:27 +02:00 committed by GitHub
parent e2f7862404
commit 39beeb61f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 91 additions and 25 deletions

View file

@ -1,7 +1,7 @@
use crate::context::PyFormatContext;
use crate::expression::parentheses::{NeedsParentheses, OptionalParentheses};
use crate::{not_yet_implemented, FormatNodeRule, PyFormatter};
use ruff_formatter::{write, Buffer, FormatResult};
use crate::{FormatNodeRule, PyFormatter};
use ruff_formatter::FormatResult;
use ruff_python_ast::node::AnyNodeRef;
use ruff_python_ast::ExprFormattedValue;
@ -9,8 +9,8 @@ use ruff_python_ast::ExprFormattedValue;
pub struct FormatExprFormattedValue;
impl FormatNodeRule<ExprFormattedValue> for FormatExprFormattedValue {
fn fmt_fields(&self, item: &ExprFormattedValue, f: &mut PyFormatter) -> FormatResult<()> {
write!(f, [not_yet_implemented(item)])
fn fmt_fields(&self, _item: &ExprFormattedValue, _f: &mut PyFormatter) -> FormatResult<()> {
unreachable!("Handled inside of `FormatExprFString");
}
}