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

Commit 6a83cd7

Browse files
author
Ivan Senji
committed
Quick panel for functions is now also filled with selection. Multiple selections are joined.
1 parent 672da7d commit 6a83cd7

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

SQLTools.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -412,20 +412,24 @@ def selectTable(callback):
412412
sublime.message_dialog('Your database has no tables.')
413413
return
414414

415-
w = Window();
416-
view = w.active_view()
417-
text = view.substr(view.sel()[0])
418-
w.show_quick_panel(ST.tables, callback)
419-
w.run_command('insert', {'characters': text})
420-
w.run_command("select_all")
415+
ST.show_quick_panel_with_selection(ST.tables, callback)
421416

422417
@staticmethod
423418
def selectFunction(callback):
424419
if len(ST.functions) == 0:
425420
sublime.message_dialog('Your database has no functions.')
426421
return
427422

428-
Window().show_quick_panel(ST.functions, callback)
423+
ST.show_quick_panel_with_selection(ST.functions, callback)
424+
425+
@staticmethod
426+
def show_quick_panel_with_selection(arrayOfValues, callback):
427+
w = Window();
428+
view = w.active_view()
429+
text = " ".join(map(lambda s: view.substr(s), view.sel())).replace('\n', ' ')
430+
w.show_quick_panel(arrayOfValues, callback)
431+
w.run_command('insert', {'characters': text})
432+
w.run_command("select_all")
429433

430434
@staticmethod
431435
def on_query_completions(view, prefix, locations):

0 commit comments

Comments
 (0)