Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


"view.sel()" returns a Selection rather than RegionSet. #26

skuroda opened this Issue · 7 comments

2 participants


The API documentation specifies the return of a RegionSet.

Initial forum issue.

Not a member of the org yet so can't add the labels. If someone could do that, or add me to the org I'd appreciate it. Of course, remove this part of the issue after doing that :smile:


Created a new Documentation category with a different color for this since it's not that ST-related regarding internals. Not sure about a "Type" label though so I just chose to add none which seems to be the best option here.

Regarding the org, I think we need some kind of a policy here because we obviously can't just add anyone (since you'll be granted push-access to numerous other plugins within this org as well). Maybe we need a different rank for the org that only grants access to this repo but I don't know if that's possible. That's why I didn't add you as of now (it's not like I knew how or whether I am able to do this in the first place, lol).


No problem, I don't know how much I'd be back to check this anyways. I'll just leave it to you folks who are already a port of the org. Anyways, I'm not 100% sure it should be classified as a documentation issue. Selection is not documented anywhere. In addition, in ST2, these returned RegionSets. Guess we'll just have to see what jps does.


Considering that sublime_api internally refers to these as "selection" as well makes me think that this is an intended change and just didn't make it to the docs (I mean, it does make sense).

And since you don't instantiate these objects manually this would only make a difference when using isinstance() to check parameter validity or something which is also rarely an issue.


Makes sense. As far as I can tell, the only "difference" between the two is the implementation of the contains method. For selection, this always returns None rather than True or False as one might expect. That aside, I think many users would agree that documentation (API related or otherwise) needs an update, including removing the old ST1 docs.

class Selection(object):
    # ...
    def contains(self, region):
        sublime_api.view_selection_contains(self.view_id, region.a, region.b)

Not sure why but I'm getting the feeling I know why this is always returning None. ;) Seems like you discovered a real bug.


To be fair I didn't find it. All credit to the forum poster. But I figured it would be a good thing to post here too. It got buried on the forum already, and I feel API issues are things that would come up for someone else eventually. :)


Documentation updated and call fixed in build 3034

@skuroda skuroda closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.