Sublime Forum

Scope Hunter


After goofing around with some others in another thread and debating with them the best way to get the scope, I put this together to accommodate everyone’s preferences.

It supports multi-select. You can have it display the scope to in a popup output panel, you can have it just log the scopes to the console, and you can have the first selection’s scope displayed in the status bar. It also allows you to display the extent of the scope by points or by line and column. You can have it copy the scopes to the clipboard for you, and you can also toggle an instant mode that will display the scope as you move your cursor around. All of these can be enabled or disabled.

This is really only useful for plugin developers.

It will hopefully be on Package Control soon.


Fountain screenwriting format support

Version 0.4.0

  • Add highlight scope extent option
  • Remove console logging

Added new option to highlight extent to give you a visual representation of of like regions of scoping.

There is a configurable threshold, so it wont highlight your whole document if you click on something that is only scoped with something like python.source

I did end up removing console logging. Now this might make some people sad, but during instant scoping, you get sometimes multiple events for only one selection action which makes things confusing in the console, especially when you are using multi-select. With the panel and status bar, it is no big deal, because it just gets updated and the user is none the wiser, but with console, you get a list of all of the events and then you don’t know which one is which.

Ultimately, I find performance more important than console logging. But if people really want console logging back, I will add it for non-instant scoping, and I will revert to the panel during instant scoping.



Console logging is back again. I worked out the issues.

Every plugin has different requirements, so it is hard to use one unaltered way to minimize on_selection_modified events to boost performance, and provide the exact functionality to you want. I spent a little time tweaking the Scope Hunter’s algorithm, and I can now throw away the redundant console logging.

So those who enjoy sending the scope to console can now be happy. Sorry I pulled it prematurely.

I think that is it for this plugin. There really isn’t much more to do with a scope plugin. Enjoy.

Version 0.4.1

  • Console logging is back


Thanks faceless. I’m impressed by your speed of plugin development!



Thanks, but I am only fast because I have solved most of the same issues in other plugins. Not much original work needed to be done on this. Most of the code was copied and pasted from my other plugins. It is kind of like Lego code blocks. Grabbing the scope is easy, after that it was just grabbing the functional blocks from everything else I already have and doing a little tweaking for the specific purpose of this plugin.

Makes me seem faster than I am :smile:.



Well that’s good modularity then, still a skill!




You code/post/fork/bugfix/etc much faster than I can follow.

I had a bit of time to play around with the plugin (the pre-console version) earlier. I was so happy with the instant scoper, I didn’t even miss the console.

Thanks again for a brilliant plugin.

(I had to throw together an “example” file, because the .tmLanguage I was working on has very long extents in “real world” files – think Markdown paragraphs – and I think the addition of the console will might help troubleshooting stuff down the line. So thank you also for working to include that :smile: )



Does this still work? Maybe I’m missing something obvious, but I’ve been fiddling with it on two different machines (dev build 2216 and v2.0.1 build 2217) and can’t get anything to appear anywhere. Both installed via Package Control.



Works fine here. All of my plugins should be working on ST2 release.

How are you trying to invoke it?

It doesn’t do anything automatically. You press ctrl+shift+p (replace ctrl with super if on mac) and start typing scope hunter. You will see two options, one that will show the scope under the cursor, and one that will toggle instant scoping on which will constantly show you the scope every time you move the cursor (this can be toggled back off when you are done using it. Depending on your scope hunter settings, this will highlight the current scope (if it doesn’t extend too far), show the scope in the console, show scope in a special popup panel, show scope in the status bar, copy scope to clipboard, etc. blah, blah, you get the idea.



This is an incredibly useful plug-in, thank you for making it available!



Thanks! :smile:



Oh my goodness, this plugin has saved my life. I wish I knew about it earlier!

(For those who try it and don’t think it’s working, I had to restart Sublime after installing with Package Control for it to work right.)