-
Notifications
You must be signed in to change notification settings - Fork 948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
formatter panic with comment between joined f-strings #6898
Comments
What's the correct way to read
|
I imagine the ruff/crates/ruff_python_formatter/src/comments/placement.rs Lines 122 to 126 in fbc9b5a
Edit: noise probably isn't a good way to describe it. I mean it's lexed as |
I think the |
i believe the issue is that the preceding node is the the printed slice is
|
the previous solution was re-assigning the comment from the |
Yeah, makes sense. I can probably restore it. |
i found this when trying to test #6365 after rebasing on top of the refactor in the pr description. |
## Summary Restores the dangling comment handling for f-strings, which broke with the parenthesized expression code. Closes #6898. ## Test Plan `cargo test` No change in any of the similarity indexes or changed file counts: | project | similarity index | total files | changed files | |--------------|------------------:|------------------:|------------------:| | cpython | 0.76083 | 1789 | 1632 | | django | 0.99957 | 2760 | 67 | | transformers | 0.99927 | 2587 | 468 | | twine | 0.99982 | 33 | 1 | | typeshed | 0.99978 | 3496 | 2173 | | warehouse | 0.99818 | 648 | 24 | | zulip | 0.99942 | 1437 | 32 |
a3d4f08 moved the f-string comment handling added in f091b46 (which unfortunately didn't add enough test cases)
panics with
The text was updated successfully, but these errors were encountered: