Skip to content

Commit

Permalink
Document missing parent problem
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin committed Oct 11, 2023
1 parent b5e6fad commit 9addbb3
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion crates/ruff_python_formatter/src/expression/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,24 @@ fn format_with_parentheses_comments(
f: &mut PyFormatter,
) -> FormatResult<()> {
// First part: Split the comments
// TODO: deduplicate

// TODO: This is copied from `parenthesized_range`, except that we don't have the parent, which
// is a problem:
// ```python
// f(
// # a
// (a)
// )
// ```
// gets formatted as
// ```python
// f(
// (
// # a
// a
// )
// )
// ```
let right_tokenizer = SimpleTokenizer::new(
f.context().source(),
TextRange::new(expression.end(), f.context().source().text_len()),
Expand Down

0 comments on commit 9addbb3

Please sign in to comment.