Python sublime.DRAW_SOLID_UNDERLINE Examples

The following are 7 code examples of sublime.DRAW_SOLID_UNDERLINE(). 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: tracker.py    From sublime-text-plugin with MIT License 5 votes vote down vote up
def mark(self, view: sublime.View):
        "Marks tracker in given view"
        scope = emmet.get_settings('marker_scope', 'region.accent')
        mark_opt = sublime.DRAW_SOLID_UNDERLINE | sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE
        view.erase_regions(ABBR_REGION_ID)
        view.add_regions(ABBR_REGION_ID, [self.region], scope, '', mark_opt)
        if self.forced:
            phantoms = [sublime.Phantom(self.region, forced_indicator('⋮>'), sublime.LAYOUT_INLINE)]
            if not self.forced_indicator:
                self.forced_indicator = sublime.PhantomSet(view, ABBR_REGION_ID)
            self.forced_indicator.update(phantoms) 
Example #2
Source File: abbreviation.py    From sublime-text-plugin with MIT License 5 votes vote down vote up
def mark(editor: sublime.View, tracker: AbbreviationTracker):
    "Marks tracker in given view"
    scope = get_settings('marker_scope', 'region.accent')
    mark_opt = sublime.DRAW_SOLID_UNDERLINE | sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE
    editor.erase_regions(ABBR_REGION_ID)
    editor.add_regions(ABBR_REGION_ID, [tracker.region], scope, '', mark_opt)
    if isinstance(tracker, AbbreviationTrackerValid) and tracker.forced:
        phantoms = [
            sublime.Phantom(tracker.region, forced_indicator('⋮>'), sublime.LAYOUT_INLINE)
        ]

        key = editor.id()
        if key not in _forced_indicator:
            _forced_indicator[key] = sublime.PhantomSet(editor, ABBR_REGION_ID)
        _forced_indicator[key].update(phantoms) 
Example #3
Source File: highlights.py    From LSP with MIT License 5 votes vote down vote up
def _handle_response(self, response: Optional[List]) -> None:
        if not response:
            return
        kind2regions = {}  # type: Dict[str, List[sublime.Region]]
        for kind in range(0, 4):
            kind2regions[_kind2name[kind]] = []
        for highlight in response:
            r = range_to_region(Range.from_lsp(highlight["range"]), self.view)
            kind = highlight.get("kind", DocumentHighlightKind.Unknown)
            if kind is not None:
                kind2regions[_kind2name[kind]].append(r)
        if settings.document_highlight_style == "fill":
            flags = 0
        elif settings.document_highlight_style == "box":
            flags = sublime.DRAW_NO_FILL
        else:
            flags = sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE
            if settings.document_highlight_style == "underline":
                flags |= sublime.DRAW_SOLID_UNDERLINE
            elif settings.document_highlight_style == "stippled":
                flags |= sublime.DRAW_STIPPLED_UNDERLINE
            elif settings.document_highlight_style == "squiggly":
                flags |= sublime.DRAW_SQUIGGLY_UNDERLINE

        self._clear_regions()
        for kind_str, regions in kind2regions.items():
            if regions:
                scope = settings.document_highlight_scopes.get(kind_str, None)
                if scope:
                    self.view.add_regions("lsp_highlight_{}".format(kind_str),
                                          regions, scope=scope, flags=flags) 
Example #4
Source File: mouse.py    From Terminus with MIT License 5 votes vote down vote up
def on_hover(self, view, point, hover_zone):
        terminal = Terminal.from_id(view.id())
        if not terminal:
            return
        if hover_zone != sublime.HOVER_TEXT:
            return
        url = find_url(view, pt=point)

        if not url:
            return

        def on_navigate(action):
            if action == "open":
                webbrowser.open_new_tab(url)

        def on_hide():
            if link_key:
                view.erase_regions(link_key)

        url_region = find_url_region(view, pt=point)
        link_key = None
        if url_region:
            link_key = highlight_key(view)
            view.add_regions(
                link_key,
                [sublime.Region(*url_region)],
                "meta",
                flags=sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE | sublime.DRAW_SOLID_UNDERLINE)

        view.show_popup(
            URL_POPUP,
            sublime.HIDE_ON_MOUSE_MOVE_AWAY,
            location=point,
            on_navigate=on_navigate, on_hide=on_hide) 
Example #5
Source File: window_view.py    From JavaScriptEnhancements with MIT License 5 votes vote down vote up
def add_link(self, text, link, scope, key="click", icon="", flags=sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE | sublime.DRAW_SOLID_UNDERLINE, region_id="", padding=0, display_block=False, insert_point=None, replace_points=[]):
    self.add(text, key=key, scope=scope, icon=icon, flags=flags, region_id=region_id, padding=padding, display_block=display_block, insert_point=insert_point, replace_points=replace_points)

    self.add_event_listener("drag_select", key+"."+scope, lambda view: sublime.active_window().run_command("open_url", args={"url": link})) 
Example #6
Source File: popup_error_vis.py    From EasyClangComplete with MIT License 4 votes vote down vote up
def __init__(self, settings):
        """Initialize error visualization.

        Args:
            mark_gutter (bool): add a mark to the gutter for error regions
        """
        gutter_style = settings.gutter_style
        mark_style = settings.linter_mark_style
        self.settings = settings

        self.err_regions = {}
        if gutter_style == SettingsStorage.GUTTER_COLOR_STYLE:
            self.gutter_mark_error = PATH_TO_ICON.format(
                icon="error.png")
            self.gutter_mark_warning = PATH_TO_ICON.format(
                icon="warning.png")
        elif gutter_style == SettingsStorage.GUTTER_MONO_STYLE:
            self.gutter_mark_error = PATH_TO_ICON.format(
                icon="error_mono.png")
            self.gutter_mark_warning = PATH_TO_ICON.format(
                icon="warning_mono.png")
        elif gutter_style == SettingsStorage.GUTTER_DOT_STYLE:
            self.gutter_mark_error = PATH_TO_ICON.format(
                icon="error_dot.png")
            self.gutter_mark_warning = PATH_TO_ICON.format(
                icon="warning_dot.png")
        else:
            log.error("Unknown option for gutter_style: %s", gutter_style)
            self.gutter_mark_error = ""
            self.gutter_mark_warning = ""

        if mark_style == SettingsStorage.MARK_STYLE_OUTLINE:
            self.draw_flags = sublime.DRAW_EMPTY | sublime.DRAW_NO_FILL
        elif mark_style == SettingsStorage.MARK_STYLE_FILL:
            self.draw_flags = 0
        elif mark_style == SettingsStorage.MARK_STYLE_SOLID_UNDERLINE:
            self.draw_flags = sublime.DRAW_NO_FILL | \
                sublime.DRAW_NO_OUTLINE | sublime.DRAW_SOLID_UNDERLINE
        elif mark_style == SettingsStorage.MARK_STYLE_STIPPLED_UNDERLINE:
            self.draw_flags = sublime.DRAW_NO_FILL | \
                sublime.DRAW_NO_OUTLINE | sublime.DRAW_STIPPLED_UNDERLINE
        elif mark_style == SettingsStorage.MARK_STYLE_SQUIGGLY_UNDERLINE:
            self.draw_flags = sublime.DRAW_NO_FILL | \
                sublime.DRAW_NO_OUTLINE | sublime.DRAW_SQUIGGLY_UNDERLINE
        else:
            self.draw_flags = sublime.HIDDEN 
Example #7
Source File: syntax.py    From omnisharp-sublime with MIT License 4 votes vote down vote up
def _handle_codeerrors(self, data):
        print('handling Errors')
        if data is None:
            print('no data')
            return
        
        self.data = data
        self.underlines = []
        self.warninglines = []
        self.errlines = []
        oops_map = {}

        if "QuickFixes" in self.data and self.data["QuickFixes"] != None and len(self.data["QuickFixes"]) > 0:
            self.data["QuickFixes"].sort(key = lambda a:(a['Line'],a['Column']))
            self.outputpanel.write_line("File: "+self.data["QuickFixes"][0]["FileName"]+"\n")
            suppressHidden = bool(helpers.get_settings(self.view,'omnisharp_suppresshidden'))
            for i in self.data["QuickFixes"]:
                point = self.view.text_point(i["Line"]-1, i["Column"]-1)
                reg = self.view.word(point)
                region_that_would_be_looked_up = self.view.word(reg.begin())
                if region_that_would_be_looked_up.begin() != reg.begin() or region_that_would_be_looked_up.end() != reg.end():
                    reg = sublime.Region(point, point+1)
                # self.underlines.append(reg)

                if i["LogLevel"] == "Hidden" and suppressHidden:
                    continue
                if i["LogLevel"] == "Warning" :
                    self.warninglines.append(reg)
                if i["LogLevel"] == "Error" :
                    self.errlines.append(reg)
                key = "%s,%s" % (reg.a, reg.b)
                oops_map[key] = i["Text"].strip()
                self.outputpanel.write_line(i["LogLevel"] + " : " + i["Text"].strip() + " - (" + str(i["Line"]) + ", " + str(i["Column"]) + ")")
            showErrorPanel = bool(helpers.get_settings(self.view,'omnisharp_showerrorwindows'))
            showWarningPanel = bool(helpers.get_settings(self.view,'omnisharp_showwarningwindows'))
            haveError = len(self.errlines) > 0
            if haveError:
                # print('underlines')
                self.view.settings().set("oops", oops_map)
                self.view.add_regions("oops", self.errlines, "sublimelinter.mark.error", "circle",  sublime.DRAW_NO_FILL|sublime.DRAW_NO_OUTLINE|sublime.DRAW_SOLID_UNDERLINE )
                if showErrorPanel:
                    self.view.window().run_command("show_panel", {"panel": "output.variable_get"})
            if len(self.warninglines) > 0:
                # print('underlines')
                self.view.settings().set("oops", oops_map)
                self.view.add_regions("oops", self.warninglines, "sublimelinter.mark.warning", "dot", sublime.DRAW_NO_FILL + sublime.DRAW_NO_OUTLINE + sublime.DRAW_SQUIGGLY_UNDERLINE )
                if (not haveError or not showErrorPanel) and showWarningPanel:
                    self.view.window().run_command("show_panel", {"panel": "output.variable_get"})

        self.data = None

        # Make error panel be scrolled to top so that we can see the first error:
        self.outputpanel.view.set_viewport_position((0,0))