Skip to content
This repository was archived by the owner on Mar 12, 2020. It is now read-only.

Commit 5ea500f

Browse files
committed
output syntax related code redability improvement
1 parent 40a3da7 commit 5ea500f

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

SQLTools.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,14 @@ def getSelection():
180180
return text
181181

182182

183+
def getCurrentSyntax():
184+
view = View()
185+
currentSyntax = None
186+
if view:
187+
currentSyntax = view.settings().get('syntax')
188+
return currentSyntax
189+
190+
183191
class ST(EventListener):
184192
conn = None
185193
tables = []
@@ -391,10 +399,7 @@ def cb(index):
391399

392400
class StDescTable(WindowCommand):
393401
def run(self):
394-
view = self.window.active_view()
395-
currentSyntax = None
396-
if view:
397-
currentSyntax = view.settings().get('syntax')
402+
currentSyntax = getCurrentSyntax()
398403

399404
if not ST.conn:
400405
ST.selectConnection(tablesCallback=lambda: Window().run_command('st_desc_table'))
@@ -410,10 +415,7 @@ def cb(index):
410415

411416
class StDescFunction(WindowCommand):
412417
def run(self):
413-
view = self.window.active_view()
414-
currentSyntax = None
415-
if view:
416-
currentSyntax = view.settings().get('syntax')
418+
currentSyntax = getCurrentSyntax()
417419

418420
if not ST.conn:
419421
ST.selectConnection(functionsCallback=lambda: Window().run_command('st_desc_function'))

0 commit comments

Comments
 (0)