From 4bdd99f8822d914a59f918fc46bbd17a88e2fe47 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Wed, 23 Aug 2023 09:59:36 +0200 Subject: [PATCH] Fix: Re-add missing node start positions (#6780) --- crates/ruff_python_formatter/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/ruff_python_formatter/src/lib.rs b/crates/ruff_python_formatter/src/lib.rs index 92e404d15cb66..39ac5ed30dda5 100644 --- a/crates/ruff_python_formatter/src/lib.rs +++ b/crates/ruff_python_formatter/src/lib.rs @@ -54,7 +54,13 @@ where if self.is_suppressed(node_comments.trailing, f.context()) { suppressed_node(node.as_any_node_ref()).fmt(f) } else { - leading_comments(node_comments.leading).fmt(f)?; + write!( + f, + [ + leading_comments(node_comments.leading), + source_position(node.start()) + ] + )?; self.fmt_fields(node, f)?; self.fmt_dangling_comments(node_comments.dangling, f)?;