Skip to content

Commit b057571

Browse files
authored
Update import_symbol.py
put imports first, then sort by depth, then by name
1 parent 480f183 commit b057571

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/commands/import_symbol.py

Lines changed: 9 additions & 1 deletion
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)