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

Commit 008b5df

Browse files
committed
display status bar message, when running SQL cmd
1 parent b811ca8 commit 008b5df

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

SQLTools.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from .SQLToolsAPI.History import History
1717
from .SQLToolsAPI.Completion import Completion
1818

19+
MESSAGE_RUNNING_CMD = 'Executing SQL command...'
1920
SYNTAX_PLAIN_TEXT = 'Packages/Text/Plain text.tmLanguage'
2021
SYNTAX_SQL = 'Packages/SQL/SQL.tmLanguage'
2122
SQLTOOLS_SETTINGS_FILE = 'SQLTools.sublime-settings'
@@ -115,6 +116,8 @@ def loadDefaultConnection():
115116

116117

117118
def output(content, panel=None, syntax=None, prependText=None):
119+
# hide previously set command running message (if any)
120+
Window().status_message('')
118121
if not panel:
119122
panel = getOutputPlace(syntax)
120123
if prependText:
@@ -389,6 +392,7 @@ def run():
389392
def cb(index):
390393
if index < 0:
391394
return None
395+
Window().status_message(MESSAGE_RUNNING_CMD)
392396
tableName = ST.tables[index]
393397
prependText = 'Table "{tableName}"\n'.format(tableName=tableName)
394398
return ST.conn.getTableRecords(
@@ -409,6 +413,7 @@ def run(self):
409413
def cb(index):
410414
if index < 0:
411415
return None
416+
Window().status_message(MESSAGE_RUNNING_CMD)
412417
return ST.conn.getTableDescription(ST.tables[index], partial(output, syntax=currentSyntax))
413418

414419
ST.selectTable(cb)
@@ -425,6 +430,7 @@ def run(self):
425430
def cb(index):
426431
if index < 0:
427432
return None
433+
Window().status_message(MESSAGE_RUNNING_CMD)
428434
functionName = ST.functions[index].split('(', 1)[0]
429435
return ST.conn.getFunctionDescription(functionName, partial(output, syntax=currentSyntax))
430436

@@ -440,16 +446,18 @@ def run():
440446
ST.selectConnection(tablesCallback=lambda: Window().run_command('st_explain_plan'))
441447
return
442448

449+
Window().status_message(MESSAGE_RUNNING_CMD)
443450
ST.conn.explainPlan(getSelection(), output)
444451

445452

446453
class StExecute(WindowCommand):
447454
@staticmethod
448455
def run():
449456
if not ST.conn:
450-
ST.selectConnection(tablesCallback=lambda: ST.conn.execute(getSelection(), output))
457+
ST.selectConnection(tablesCallback=lambda: Window().run_command('st_execute'))
451458
return
452459

460+
Window().status_message(MESSAGE_RUNNING_CMD)
453461
ST.conn.execute(getSelection(), output)
454462

455463

0 commit comments

Comments
 (0)