Skip to content
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

bug: iSort repeating the last line of code when adding new line between imports #2303

Open
yash0307jain opened this issue Nov 9, 2024 · 0 comments

Comments

@yash0307jain
Copy link

yash0307jain commented Nov 9, 2024

When I am trying to use isort in this particular code

from django.contrib import admin
from .models import Category, Channel, Server

# Register your models here.
admin.site.register(Channel)
admin.site.register(Server)
admin.site.register(Category)

After saving the file when iSort runs then it is giving this code

from django.contrib import admin

from .models import Category, Channel, Server

# Register your models here.
admin.site.register(Channel)
admin.site.register(Server)
admin.site.register(Category)
admin.site.register(Category)

It add the last of code, due to which admin.site.register(Category) appears twice in the end.

My vscode isort config:

    "isort.args": ["--profile", "black"],
    "black-formatter.args": ["--line-length", "119"],
    "flake8.args": ["--max-line-length", "119"],
    "[python]": {
        "editor.formatOnSave": true,
        "editor.defaultFormatter": "ms-python.black-formatter",
        "editor.codeActionsOnSave": {
            "source.organizeImports": "always"
        }
    },

How to fix this issue?

@yash0307jain yash0307jain changed the title iSort repeating the last line of code when adding new line between imports bug: iSort repeating the last line of code when adding new line between imports Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant