Sublime Forum

run_command "show_overlay" from plugin [solved]

#1

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]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”})[/code]

Do I miss something, maybe?

0 Likes

#2

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

1 Like

#3

+1

This what I just write:

class GotoSelectionCommand(sublime_plugin.TextCommand): :smiley:
Les grands esprits se rencontrent…

Shame that this amazing functionality isn’t available to plugin.

1 Like

#4

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.

1 Like

#5

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!

1 Like

#6

[quote=“bronson”]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![/quote]

Here it is github.com/bizoo/GotoSelection . Just googled it by title.

1 Like