Skip to content

Commit

Permalink
Quick panel for functions is now also filled with selection. Multiple…
Browse files Browse the repository at this point in the history
… selections are joined.
  • Loading branch information
Ivan Senji committed Mar 4, 2019
1 parent 672da7d commit 6a83cd7
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions SQLTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,20 +412,24 @@ def selectTable(callback):
sublime.message_dialog('Your database has no tables.')
return

w = Window();
view = w.active_view()
text = view.substr(view.sel()[0])
w.show_quick_panel(ST.tables, callback)
w.run_command('insert', {'characters': text})
w.run_command("select_all")
ST.show_quick_panel_with_selection(ST.tables, callback)

@staticmethod
def selectFunction(callback):
if len(ST.functions) == 0:
sublime.message_dialog('Your database has no functions.')
return

Window().show_quick_panel(ST.functions, callback)
ST.show_quick_panel_with_selection(ST.functions, callback)

@staticmethod
def show_quick_panel_with_selection(arrayOfValues, callback):
w = Window();
view = w.active_view()
text = " ".join(map(lambda s: view.substr(s), view.sel())).replace('\n', ' ')
w.show_quick_panel(arrayOfValues, callback)
w.run_command('insert', {'characters': text})
w.run_command("select_all")

@staticmethod
def on_query_completions(view, prefix, locations):
Expand Down

0 comments on commit 6a83cd7

Please sign in to comment.