def show_highlight(self, view):
        valid_regions = []
        show_highlight = view.settings().get(OpenSearchResultKeys.HIGHLIGHT_ENABLED, False)
        scope = view.settings().get(OpenSearchResultKeys.SCOPE_SETTINGS, self.DEFAULT_SCOPE)
        icon = view.settings().get(OpenSearchResultKeys.ICON_SETTINGS, self.DEFAULT_ICON)
        open_everywhere = view.settings().get(OpenSearchResultKeys.OPEN_EVERYWHERE, False)

        if open_everywhere == False and view.name() != 'Find Results':
            return

        for s in view.sel():
            line = view.line(s)
            line_str = view.substr(view.line(s))
            line_num = parse_line_number(line_str)

            if is_file_path(line_str) or line_num:
                valid_regions.append(line)

        if valid_regions:
            if show_highlight:
                options = sublime.DRAW_EMPTY | sublime.DRAW_OUTLINED
            else:
                options = sublime.HIDDEN

            view.add_regions(
                self.HIGHLIGHT_REGION_NAME, valid_regions, scope, icon, options)
        else:
            view.erase_regions(self.HIGHLIGHT_REGION_NAME)
Beispiel #2
0
    def show_highlight(self, view):
        valid_regions = []
        show_highlight = view.settings().get(self.HIGHLIGHT_ENABLED_KEY, False)
        scope = view.settings().get(self.SCOPE_SETTINGS_KEY,
                                    self.DEFAULT_SCOPE)
        icon = view.settings().get(self.ICON_SETTINGS_KEY, self.DEFAULT_ICON)

        if view.name() != 'Find Results':
            return

        for s in view.sel():
            line = view.line(s)
            line_str = view.substr(view.line(s))
            line_num = util.parse_line_number(line_str)

            if util.is_file_path(line_str) or line_num:
                valid_regions.append(line)

        if valid_regions:
            if show_highlight:
                options = sublime.DRAW_EMPTY | sublime.DRAW_OUTLINED
            else:
                options = sublime.HIDDEN

            view.add_regions(self.HIGHLIGHT_REGION_NAME, valid_regions, scope,
                             icon, options)
        else:
            view.erase_regions(self.HIGHLIGHT_REGION_NAME)
Beispiel #3
0
    def show_highlight(self, view):
        valid_regions = []
        show_highlight = view.settings().get(
            OpenSearchResultKeys.HIGHLIGHT_ENABLED, False)
        scope = view.settings().get(OpenSearchResultKeys.SCOPE_SETTINGS,
                                    self.DEFAULT_SCOPE)
        icon = view.settings().get(OpenSearchResultKeys.ICON_SETTINGS,
                                   self.DEFAULT_ICON)
        open_everywhere = view.settings().get(
            OpenSearchResultKeys.OPEN_EVERYWHERE, False)

        if open_everywhere == False and view.name() != 'Find Results':
            return

        for s in view.sel():
            line = view.line(s)
            line_str = view.substr(view.line(s))
            line_num = parse_line_number(line_str)

            if is_file_path(line_str) or line_num:
                valid_regions.append(line)

        if valid_regions:
            if show_highlight:
                options = sublime.DRAW_EMPTY | sublime.DRAW_OUTLINED
            else:
                options = sublime.HIDDEN

            view.add_regions(self.HIGHLIGHT_REGION_NAME, valid_regions, scope,
                             icon, options)
        else:
            view.erase_regions(self.HIGHLIGHT_REGION_NAME)
    def show_highlight(self, view):
        valid_regions = []
        show_highlight = view.settings().get(self.HIGHLIGHT_ENABLED_KEY, False)
        scope = view.settings().get(self.SCOPE_SETTINGS_KEY, self.DEFAULT_SCOPE)
        icon = view.settings().get(self.ICON_SETTINGS_KEY, self.DEFAULT_ICON)

        if view.name() != 'Find Results':
            return

        for s in view.sel():
            line = view.line(s)
            line_str = view.substr(view.line(s))
            line_num = util.parse_line_number(line_str)

            if util.is_file_path(line_str) or line_num:
                valid_regions.append(line)

        if valid_regions:
            if show_highlight:
                options = sublime.DRAW_EMPTY | sublime.DRAW_OUTLINED
            else:
                options = sublime.HIDDEN

            view.add_regions(
                self.HIGHLIGHT_REGION_NAME, valid_regions, scope, icon, options)
        else:
            view.erase_regions(self.HIGHLIGHT_REGION_NAME)
Beispiel #5
0
    def run(self, edit):
        for cursor in self.view.sel():
            cur_line = self.view.line(cursor)
            line_str = self.view.substr(cur_line).strip()
            line_num = util.parse_line_number(line_str)

            if self.view.name() != 'Find Results':
                return

            if util.is_file_path(line_str):
                self.open_file_path(line_str)
            elif line_num:
                self.open_file_at_line_num(cur_line, line_num)
    def run(self, edit):
        for cursor in self.view.sel():
            cur_line = self.view.line(cursor)
            line_str = self.view.substr(cur_line).strip()
            line_num = util.parse_line_number(line_str)

            if self.view.name() != 'Find Results':
                return

            if util.is_file_path(line_str):
                self.open_file_path(line_str)
            elif line_num:
                self.open_file_at_line_num(cur_line, line_num)
    def run(self, edit):
        open_everywhere = self.view.settings().get(OpenSearchResultKeys.OPEN_EVERYWHERE, False)
        for cursor in self.view.sel():
            cur_line = self.view.line(cursor)
            line_str = self.view.substr(cur_line).strip()
            line_num = parse_line_number(line_str)

            if open_everywhere == False and self.view.name() != 'Find Results':
                return

            if is_file_path(line_str):
                self.open_file_path(line_str)
            elif line_num:
                self.open_file_at_line_num(cur_line, line_num)
    def open_file_at_line_num(self, cur_line, line_num):
        """
        Starting at the position `cur_line` (a `Region`), count backwards
        until we find a path or the beginning of the file. If we find a file
        path, open it in a new tab at `line_num`.
        """
        prev = cur_line
        while True:
            prev = self.previous_line(prev)
            if prev is None:
                break

            line = self.view.substr(prev).strip()
            if is_file_path(line):
                return self.open_file_from_line(line, line_num)
Beispiel #9
0
    def open_file_at_line_num(self, cur_line, line_num):
        """
        Starting at the position `cur_line` (a `Region`), count backwards
        until we find a path or the beginning of the file. If we find a file
        path, open it in a new tab at `line_num`.
        """
        prev = cur_line
        while True:
            prev = self.previous_line(prev)
            if prev is None:
                break

            line = self.view.substr(prev).strip()
            if util.is_file_path(line):
                return self.open_file_from_line(line, line_num)
Beispiel #10
0
    def run(self, edit):
        open_everywhere = self.view.settings().get(
            OpenSearchResultKeys.OPEN_EVERYWHERE, False)
        for cursor in self.view.sel():
            cur_line = self.view.line(cursor)
            line_str = self.view.substr(cur_line).strip()
            line_num = parse_line_number(line_str)

            if open_everywhere == False and self.view.name() != 'Find Results':
                return

            if is_file_path(line_str):
                self.open_file_path(line_str)
            elif line_num:
                self.open_file_at_line_num(cur_line, line_num)