1616from .SQLToolsAPI .History import History
1717from .SQLToolsAPI .Completion import Completion
1818
19+ MESSAGE_RUNNING_CMD = 'Executing SQL command...'
1920SYNTAX_PLAIN_TEXT = 'Packages/Text/Plain text.tmLanguage'
2021SYNTAX_SQL = 'Packages/SQL/SQL.tmLanguage'
2122SQLTOOLS_SETTINGS_FILE = 'SQLTools.sublime-settings'
@@ -115,6 +116,8 @@ def loadDefaultConnection():
115116
116117
117118def 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
446453class 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