Skip to content

Commit

Permalink
Merge pull request #18 from ric-evans/patch-1
Browse files Browse the repository at this point in the history
Update `import_symbol.py`: Re-sort Imports
  • Loading branch information
abhishek72850 committed May 11, 2024
2 parents 480f183 + b057571 commit bcb7b73
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/commands/import_symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,15 @@ def run(self):
)

self.import_statements = dict(
sorted(self.import_statements.items(), key=lambda k: k[0])
sorted(
self.import_statements.items(),
# put imports first, then sort by depth, then by name
key=lambda k: (
not k[0].startswith("import "),
k[0].count("."),
k[0],
),
)
)

self.view.erase_status(PyRockConstants.PACKAGE_NAME)
Expand Down

0 comments on commit bcb7b73

Please sign in to comment.