I’m working on a plugin called SublimeJump (https://github.com/tednaleid/SublimeJump) that lets the user jump to any visible character in the view with a couple of keystrokes. It’s very similar to EasyMotion (vim) or AceJump (emacs/intellij) if you’re familiar with those.
I’ve got most of the functionality working but I’m stumped on how to get it to respect folded areas of code. Currently it lets you jump to folded areas which it should not do.
The documented API gives us View.visible_region()
which returns a Region with the starting and ending characters on the view. As it’s a range, it doesn’t remove those areas of code that are folded.
The documented API doesn’t give any way to query for the folded areas that I can see. Unless there is a key that I can use to retrieve them from View.get_regions(key)
?
If there is a way for me to get the folded regions in the visible_region, I could easily create a list of Regions out of them that really only decorates the truly visible text with jump targets.