summaryrefslogtreecommitdiff
path: root/User/expand_to_end_of_scope.py
blob: 0498753753349ea97b620b406cc41b4368f7a4b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import sublime
import sublime_plugin


class ExpandToEndOfScopeCommand(sublime_plugin.TextCommand):
    def run(self, edit, begin=False):
        newsels = []
        for s in self.view.sel():
            scope = self.view.extract_scope(s.a)
            newsels.append(sublime.Region(scope.begin(), s.end()) if begin else sublime.Region(s.begin(), scope.end()))

        self.view.sel().add_all(newsels)