Home Download Buy Blog Forum Support

run_command "show_overlay" from plugin [solved]

run_command "show_overlay" from plugin [solved]

Postby DSHugo on Tue Sep 20, 2011 11:16 am

Recently it came up to me, that I miss some behavior from the "goto everywhere". I wanted to enhance the current "goto" (ctrl+r) a little bit, by appending selection text to "@" (e.g. if "myFunction" text is highlighted, the "Goto everywhere" popup would start with "@myFunction" rather than "@"). The problem is that I can run some commands from within plugin, but `.run_command("show_overlay", ...)` does nothing.

The plugin as of now is extremely simple, just 4 lines:
Code: Select all
import sublime, sublime_plugin

class GotoSelectionCommand(sublime_plugin.TextCommand):
   def run(self, edit):
      self.view.window().run_command("show_overlay", {"overlay": "goto", "text": "@replace_with_first_selection"})


Do I miss something, maybe?
Last edited by DSHugo on Wed Oct 05, 2011 8:28 pm, edited 2 times in total.
DSHugo
 
Posts: 42
Joined: Tue Sep 20, 2011 11:05 am

Re: run_command "show_overlay" from plugin

Postby jps on Tue Sep 20, 2011 1:13 pm

show_overlay isn't available via window.run_command. This is a deficiency in the API that I really need to get sorted.
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm

Re: run_command "show_overlay" from plugin

Postby bizoo on Wed Sep 28, 2011 12:28 pm

jps wrote:show_overlay isn't available via window.run_command. This is a deficiency in the API that I really need to get sorted.

+1

This what I just write:
Code: Select all
class GotoSelectionCommand(sublime_plugin.TextCommand):
:D
Les grands esprits se rencontrent...

Shame that this amazing functionality isn't available to plugin.
bizoo
 
Posts: 859
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: run_command "show_overlay" from plugin [wait for api fix]

Postby DSHugo on Wed Oct 05, 2011 8:26 pm

Since "show_overlay" is exposed to plugins since 2128 (thank you Jon), I've put together the mighty 13-liner to get what I originally wanted — a goto prefill. I'll try to use it as a "goto definition" within the file, since CodeIntel plugin doesn't really cope well with 13949 source code files of the project I have to deal with (and a good portion of functions is file-local anyway). At least until I figure out how to use CTags properly...

Anyway, the plugin is available at github, if anyone is interested.
DSHugo
 
Posts: 42
Joined: Tue Sep 20, 2011 11:05 am

Re: run_command "show_overlay" from plugin [solved]

Postby bronson on Wed Nov 28, 2012 10:09 pm

Where is your plugin now? It appears you deleted it from GitHub?

Just curious since I'm looking for a similar sort of thing.

Really handy that window.show_overlay works now. Thanks Jon!
bronson
 
Posts: 38
Joined: Wed Nov 28, 2012 8:52 pm

Re: run_command "show_overlay" from plugin [solved]

Postby RocketR on Fri Dec 14, 2012 12:54 am

bronson wrote:Where is your plugin now? It appears you deleted it from GitHub?

Just curious since I'm looking for a similar sort of thing.

Really handy that window.show_overlay works now. Thanks Jon!

Here it is https://github.com/bizoo/GotoSelection . Just googled it by title.
RocketR
 
Posts: 2
Joined: Fri Dec 14, 2012 12:53 am


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 8 guests

cron