本文整理汇总了Python中sublime.DRAW_SOLID_UNDERLINE属性的典型用法代码示例。如果您正苦于以下问题:Python sublime.DRAW_SOLID_UNDERLINE属性的具体用法?Python sublime.DRAW_SOLID_UNDERLINE怎么用?Python sublime.DRAW_SOLID_UNDERLINE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类sublime
的用法示例。
在下文中一共展示了sublime.DRAW_SOLID_UNDERLINE属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mark
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_SOLID_UNDERLINE [as 别名]
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)
示例2: mark
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_SOLID_UNDERLINE [as 别名]
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)
示例3: _handle_response
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_SOLID_UNDERLINE [as 别名]
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)
示例4: on_hover
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_SOLID_UNDERLINE [as 别名]
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)
示例5: add_link
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_SOLID_UNDERLINE [as 别名]
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}))
示例6: __init__
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_SOLID_UNDERLINE [as 别名]
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
示例7: _handle_codeerrors
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_SOLID_UNDERLINE [as 别名]
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))