Skip to content

Commit

Permalink
Add placement configuration of show_query
Browse files Browse the repository at this point in the history
  • Loading branch information
Coteh committed Jun 17, 2017
1 parent 337ce02 commit 2b4b23b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
5 changes: 4 additions & 1 deletion SQLTools.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"show_result_on_window" : false,
"clear_output" : true,
"safe_limit" : false,
"show_query" : false,
"show_query" : {
"enabled": false,
"placement": "top"
},
"expand_to_paragraph" : false,
"use_streams" : false, // use streams for results
/**
Expand Down
15 changes: 12 additions & 3 deletions SQLToolsAPI/Command.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,18 @@ def run(self):
resultString += errors.decode(self.encoding,
'replace').replace('\r', '')

if 'show_query' in self.options and self.options['show_query']:
formattedQueryInfo = self._formatShowQuery(self.query, queryTimerStart, queryTimerEnd)
resultString = "{0}\n{1}".format(formattedQueryInfo, resultString)
if 'show_query' in self.options:
if isinstance(self.options['show_query'], dict):
if 'enabled' not in self.options['show_query'] or self.options['show_query']['enabled']:
formattedQueryInfo = self._formatShowQuery(self.query, queryTimerStart, queryTimerEnd)
if ('placement' in self.options['show_query']
and self.options['show_query']['placement'] == "bottom"):
resultString = "{0}\n{1}".format(resultString, formattedQueryInfo)
else: # top, by default
resultString = "{0}\n{1}".format(formattedQueryInfo, resultString)
elif isinstance(self.options['show_query'], bool) and self.options['show_query']:
formattedQueryInfo = self._formatShowQuery(self.query, queryTimerStart, queryTimerEnd)
resultString = "{0}\n{1}".format(formattedQueryInfo, resultString)

self.callback(resultString)

Expand Down

0 comments on commit 2b4b23b

Please sign in to comment.