-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Import sorting deletes comments #675
Comments
I don't understand isort's comment behavior yet, trying to make sense of it. Before: # Comment 1
# Comment 2
import D
# Comment 3a
import C
# Comment 3b
import C
import B # Comment 4
# Comment 5
# Comment 6
from A import (
a, # Comment 7
b,
c, # Comment 8
)
from A import (
a, # Comment 9
b, # Comment 10
c, # Comment 11
) After: # Comment 1
# Comment 2
import B # Comment 4
# Comment 3b
# Comment 3a
import C
import D
# Comment 6
from A import a # Comment 9
from A import b # Comment 10
from A import c # Comment 11
# Comment 5 |
I'll just try to come up with something reasonable that does the right thing in the common cases (comment at end-of-line, etc.). |
Gonna try to fix this today. I've added comment extraction, now I just need to figure out the preservation strategy. |
Amazing! This is one of the two things not allowing me to switch to Ruff's sorting, I need to preserve some comments for some |
(This is a known limitation mentioned in #465 (comment), but might as well be tracked as an issue.)
ruff --select=I --fix
incorrectly transformsinto
The text was updated successfully, but these errors were encountered: