Python sublime.DRAW_OUTLINED Examples

The following are 5 code examples of sublime.DRAW_OUTLINED(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sublime , or try the search function .
Example #1
Source File: drawing_flags.py    From sublime-GitConflictResolver with MIT License 6 votes vote down vote up
def visible():
    fill = settings.get('fill_conflict_area')
    outline = settings.get('outline_conflict_area')

    flags = 0
    if _st_version < 3000:
        # If fill is set then outline is ignored; ST2 doesn't provide a combination
        if not (fill or outline):
            flags = sublime.HIDDEN
        elif not fill and outline:
            flags = sublime.DRAW_OUTLINED
    else:
        if not fill:
            flags |= sublime.DRAW_NO_FILL
        if not outline:
            flags |= sublime.DRAW_NO_OUTLINE

    return flags 
Example #2
Source File: CoalaCommand.py    From coala-sublime with GNU Affero General Public License v3.0 6 votes vote down vote up
def show_output(view):
    output_str = view.settings().get(COALA_KEY + ".output_str")
    if not output_str:
        return
    output = json.loads(output_str)

    region_flag = sublime.DRAW_OUTLINED
    regions = []

    for section_name, section_results in output["results"].items():
        for result in section_results:
            if not result["affected_code"]:
                continue
            for code_region in result["affected_code"]:
                line = view.line(
                    view.text_point(code_region["start"]["line"]-1, 0))
                regions.append(line)

    view.add_regions(COALA_KEY, regions, COALA_KEY, "dot", region_flag) 
Example #3
Source File: diffy.py    From diffy with MIT License 5 votes vote down vote up
def draw_difference(self, view, diffs):
        self.clear(view)

        lines = [d.get_region(view) for d in diffs]

        view.add_regions(
            'highlighted_lines', 
            lines, 
            'keyword', 
            'dot', 
            sublime.DRAW_OUTLINED
        )

        return lines 
Example #4
Source File: VulHint.py    From VulHint with MIT License 5 votes vote down vote up
def mark_vul(self, view):
        global g_regions
        #print([self.data[i]["discription"] for i in self.data])
        if not self.lang or not self.data:
            return
        for key,val in self.data.items():
            if not val['enable']: continue
            vul = view.find_all(val['pattern'])
            if not vul: continue
            for i in vul:
                i.a += val["abais"]
                i.b += val["bbais"]
            view.add_regions(key, vul, "string", "cross", sublime.DRAW_OUTLINED|sublime.DRAW_STIPPLED_UNDERLINE)
            g_regions.append(key) 
Example #5
Source File: references.py    From LSP with MIT License 5 votes vote down vote up
def show_references_panel(self, references_by_file: Dict[str, List[Tuple[Point, str]]]) -> None:
        window = self.view.window()
        if window:
            panel = ensure_references_panel(window)
            if not panel:
                return

            text = ''
            references_count = 0
            for file, references in references_by_file.items():
                text += '◌ {}:\n'.format(self.get_relative_path(file))
                for reference in references:
                    references_count += 1
                    point, line = reference
                    text += '\t{:>8}:{:<4} {}\n'.format(point.row + 1, point.col + 1, line)
                # append a new line after each file name
                text += '\n'

            base_dir = windows.lookup(window).get_project_path(self.view.file_name() or "")
            panel.settings().set("result_base_dir", base_dir)

            panel.run_command("lsp_clear_panel")
            window.run_command("show_panel", {"panel": "output.references"})
            panel.run_command('append', {
                'characters': "{} references for '{}'\n\n{}".format(references_count, self.word, text),
                'force': True,
                'scroll_to_end': False
            })

            # highlight all word occurrences
            regions = panel.find_all(r"\b{}\b".format(self.word))
            panel.add_regions('ReferenceHighlight', regions, 'comment', flags=sublime.DRAW_OUTLINED)