本文整理汇总了Python中sublime.DRAW_STIPPLED_UNDERLINE属性的典型用法代码示例。如果您正苦于以下问题:Python sublime.DRAW_STIPPLED_UNDERLINE属性的具体用法?Python sublime.DRAW_STIPPLED_UNDERLINE怎么用?Python sublime.DRAW_STIPPLED_UNDERLINE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类sublime
的用法示例。
在下文中一共展示了sublime.DRAW_STIPPLED_UNDERLINE属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_syntax_errors
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_STIPPLED_UNDERLINE [as 别名]
def show_syntax_errors(self, stderr):
output_view = self.view.window().create_output_panel('gotools_syntax_errors')
output_view.set_scratch(True)
output_view.settings().set("result_file_regex","^(.*):(\d+):(\d+):(.*)$")
output_view.run_command("select_all")
output_view.run_command("right_delete")
syntax_output = stderr.replace("<standard input>", self.view.file_name())
output_view.run_command('append', {'characters': syntax_output})
self.view.window().run_command("show_panel", {"panel": "output.gotools_syntax_errors"})
marks = []
for error in stderr.splitlines():
match = re.match("(.*):(\d+):(\d+):", error)
if not match or not match.group(2):
Logger.log("skipping unrecognizable error:\n" + error + "\nmatch:" + str(match))
continue
row = int(match.group(2))
pt = self.view.text_point(row-1, 0)
Logger.log("adding mark at row " + str(row))
marks.append(sublime.Region(pt))
if len(marks) > 0:
self.view.add_regions("mark", marks, "mark", "dot", sublime.DRAW_STIPPLED_UNDERLINE | sublime.PERSISTENT)
示例2: on_idle
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_STIPPLED_UNDERLINE [as 别名]
def on_idle(self, view):
"""
"""
structure_info = self._get_structure_info(view)
linting = self.get_settings(view, "linting", True)
# linting
if linting and "key.diagnostics" in structure_info:
diagnostics = structure_info["key.diagnostics"]
self.errors = {}
for entry in diagnostics:
description = entry["key.description"]
#level = entry['key.severity']
row, col = entry["key.line"], entry["key.column"]
pos = view.text_point(row-1,col-1)
self.errors[pos] = description
view.add_regions(
"swiftkitten.diagnostics",
[Region(pos,pos+1) for pos in self.errors.keys()],
"constant",
"",
sublime.DRAW_STIPPLED_UNDERLINE | sublime.DRAW_NO_OUTLINE | sublime.DRAW_NO_FILL
)
self._update_linting_status(view)
示例3: _handle_response
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_STIPPLED_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: run_coverage
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_STIPPLED_UNDERLINE [as 别名]
def run_coverage(self, view):
settings = find_flow_settings(view.window().project_data())
if not settings.get('show_coverage'):
return
result = None
try:
result = CLI(view).coverage()
except InvalidContext:
view.erase_regions('flow_error')
view.erase_regions('flow_uncovered')
except Exception as e:
display_unknown_error(self.view, e)
if not result:
return
regions = []
for line in result['expressions']['uncovered_locs']:
start = line['start']
end = line['end']
row = int(start['line']) - 1
col = int(start['column']) - 1
endrow = int(end['line']) - 1
endcol = int(end['column'])
regions.append(
rowcol_to_region(view, row, col, endcol, endrow)
)
view.add_regions(
'flow_uncovered', regions, 'comment', '',
sublime.DRAW_STIPPLED_UNDERLINE +
sublime.DRAW_NO_FILL +
sublime.DRAW_NO_OUTLINE
)
uncovered_count = result['expressions']['uncovered_count']
covered_count_text = 'Flow coverage: {} line{} uncovered'.format(
uncovered_count, '' if uncovered_count is 1 else 's'
)
view.set_status('flow_coverage', covered_count_text)
示例5: __init__
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import DRAW_STIPPLED_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