Skip to content

Commit bcb7b73

Browse files
Merge pull request #18 from ric-evans/patch-1
Update `import_symbol.py`: Re-sort Imports
2 parents 480f183 + b057571 commit bcb7b73

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/commands/import_symbol.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,15 @@ def run(self):
247247
)
248248

249249
self.import_statements = dict(
250-
sorted(self.import_statements.items(), key=lambda k: k[0])
250+
sorted(
251+
self.import_statements.items(),
252+
# put imports first, then sort by depth, then by name
253+
key=lambda k: (
254+
not k[0].startswith("import "),
255+
k[0].count("."),
256+
k[0],
257+
),
258+
)
251259
)
252260

253261
self.view.erase_status(PyRockConstants.PACKAGE_NAME)

0 commit comments

Comments
 (0)