Skip to content

Commit

Permalink
Only use show_query's 'enabled' property in stream
Browse files Browse the repository at this point in the history
  • Loading branch information
Coteh committed Jun 17, 2017
1 parent d97073c commit a61c117
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion SQLTools.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"limit": 50
},
"show_query": {
"placement": "disabled"
"enabled": true,
"placement": "top"
},
"format" : {
"keyword_case" : "upper",
Expand Down
13 changes: 7 additions & 6 deletions SQLToolsAPI/Command.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ def run(self):
if self.process:
self.process.terminate()

if 'show_query' in self.options and self.options['show_query']:
formattedQueryInfo = self._formatShowQuery(self.query, queryTimerStart, queryTimerEnd)
self.callback(formattedQueryInfo)
if 'show_query' in self.options:
if 'enabled' in self.options['show_query'] and self.options['show_query']['enabled']:
formattedQueryInfo = self._formatShowQuery(self.query, queryTimerStart, queryTimerEnd)
self.callback(formattedQueryInfo + '\n')

return

Expand All @@ -93,13 +94,13 @@ def run(self):
'replace').replace('\r', '')

if 'show_query' in self.options:
queryPlacement = self.options['show_query'].get('placement', 'disabled')
if isinstance(queryPlacement, str) and queryPlacement != 'disabled':
if 'enabled' in self.options['show_query'] and self.options['show_query']['enabled']:
formattedQueryInfo = self._formatShowQuery(self.query, queryTimerStart, queryTimerEnd)
queryPlacement = self.options['show_query'].get('placement', 'top')
if queryPlacement == 'top':
resultString = "{0}\n{1}".format(formattedQueryInfo, resultString)
elif queryPlacement == 'bottom':
resultString = "{0}\n{1}".format(resultString, formattedQueryInfo)
resultString = "{0}{1}\n".format(resultString, formattedQueryInfo)

self.callback(resultString)

Expand Down

0 comments on commit a61c117

Please sign in to comment.