Hug multiline-strings preview style (#9243)

This commit is contained in:
Micha Reiser
2024-01-10 12:47:34 +01:00
committed by GitHub
parent 6be73322da
commit ac02d3aedd
16 changed files with 590 additions and 215 deletions

View File

@@ -394,12 +394,12 @@ impl Format<PyFormatContext<'_>> for BinaryLike<'_> {
f,
[
operand.leading_binary_comments().map(leading_comments),
leading_comments(comments.leading(&string_constant)),
leading_comments(comments.leading(string_constant)),
// Call `FormatStringContinuation` directly to avoid formatting
// the implicitly concatenated string with the enclosing group
// because the group is added by the binary like formatting.
FormatStringContinuation::new(&string_constant),
trailing_comments(comments.trailing(&string_constant)),
trailing_comments(comments.trailing(string_constant)),
operand.trailing_binary_comments().map(trailing_comments),
line_suffix_boundary(),
]
@@ -413,12 +413,12 @@ impl Format<PyFormatContext<'_>> for BinaryLike<'_> {
write!(
f,
[
leading_comments(comments.leading(&string_constant)),
leading_comments(comments.leading(string_constant)),
// Call `FormatStringContinuation` directly to avoid formatting
// the implicitly concatenated string with the enclosing group
// because the group is added by the binary like formatting.
FormatStringContinuation::new(&string_constant),
trailing_comments(comments.trailing(&string_constant)),
trailing_comments(comments.trailing(string_constant)),
]
)?;
}