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

Commit 71ac4a2

Browse files
committed
Fix auto indent issue with inserting queries
1 parent f5b5227 commit 71ac4a2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

SQLTools.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,12 @@ def toNewTab(content, name="", suffix="SQLTools Saved Query"):
140140

141141

142142
def insertContent(content):
143-
currentView = View()
144-
currentView.run_command('insert', {'characters': content})
143+
view = View()
144+
settings = view.settings()
145+
autoIndent = settings.get('auto_indent', True)
146+
settings.set('auto_indent', False)
147+
view.run_command('insert', {'characters': content})
148+
settings.set('auto_indent', autoIndent)
145149

146150

147151
def getOutputPlace(syntax=None, name="SQLTools Result"):
@@ -565,7 +569,7 @@ def cb(index):
565569
ST.conn.execute(query, createOutput(),
566570
stream=settings.get('use_streams', False))
567571
elif mode == "insert":
568-
insertContent(query);
572+
insertContent(query)
569573
else:
570574
toNewTab(query, alias)
571575

0 commit comments

Comments
 (0)