ruff/crates/ruff_python_formatter/src
Dhruv Manilawala f96fa6b0e2
Do not consider f-strings with escaped newlines as multiline (#14624)
## Summary

This PR fixes a bug in the f-string formatting to not consider the
escaped newlines for `is_multiline`. This is done by checking if the
f-string is triple-quoted or not similar to normal string literals.

This is not required to be gated behind preview because the logic change
for `is_multiline` was added in
https://github.com/astral-sh/ruff/pull/14454.

## Test Plan

Add a test case which formats differently on `main`:
https://play.ruff.rs/ea3c55c2-f0fe-474e-b6b8-e3365e0ede5e
2024-11-27 10:25:38 +00:00
..
comments Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00
expression Fix f-string formatting in assignment statement (#14454) 2024-11-26 15:07:18 +05:30
module Upgrade to Rust 1.78 (#11260) 2024-05-03 12:46:21 +00:00
other Fix f-string formatting in assignment statement (#14454) 2024-11-26 15:07:18 +05:30
pattern Join implicit concatenated strings when they fit on a line (#13663) 2024-10-24 11:52:22 +02:00
snapshots Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00
statement Fix f-string formatting in assignment statement (#14454) 2024-11-26 15:07:18 +05:30
string Do not consider f-strings with escaped newlines as multiline (#14624) 2024-11-27 10:25:38 +00:00
type_param Upgrade to Rust 1.78 (#11260) 2024-05-03 12:46:21 +00:00
builders.rs Fix unnecessary space around power op in overlong f-string expressions (#14489) 2024-11-22 13:01:22 +01:00
cli.rs Build `CommentRanges` outside the parser (#11792) 2024-06-09 09:55:17 +00:00
context.rs Extract `LineIndex` independent methods from `Locator` (#13938) 2024-10-28 07:53:41 +00:00
generated.rs Normalize implicit concatenated f-string quotes per part (#13539) 2024-10-08 09:59:17 +00:00
lib.rs Extract `LineIndex` independent methods from `Locator` (#13938) 2024-10-28 07:53:41 +00:00
main.rs Formatter and parser refactoring (#7569) 2023-09-26 15:29:43 +02:00
options.rs Change default for Python version from 3.8 to 3.9 (#13896) 2024-11-20 13:11:51 +01:00
prelude.rs Accept any `Into<AnyNodeRef>` as `Comments` arguments (#5205) 2023-06-20 16:49:21 +00:00
preview.rs Fix formatting of single with-item with trailing comment (#14005) 2024-11-01 09:08:06 +01:00
range.rs Extract `LineIndex` independent methods from `Locator` (#13938) 2024-10-28 07:53:41 +00:00
shared_traits.rs ruff_python_formatter: copy and inline shared traits (#8656) 2023-11-13 12:16:04 -05:00
verbatim.rs Extract `LineIndex` independent methods from `Locator` (#13938) 2024-10-28 07:53:41 +00:00