From b05757105a6b4ea25003679d2b82750aa0fd119b Mon Sep 17 00:00:00 2001 From: Ric Evans <19216225+ric-evans@users.noreply.github.com> Date: Thu, 7 Dec 2023 17:59:26 -0600 Subject: [PATCH] Update import_symbol.py put imports first, then sort by depth, then by name --- src/commands/import_symbol.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/commands/import_symbol.py b/src/commands/import_symbol.py index 84231f9..581b74d 100644 --- a/src/commands/import_symbol.py +++ b/src/commands/import_symbol.py @@ -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)