def _toggle_indicator(self) -> None:
"""Toggle mark indicator to focus the cursor
"""
path, line, column = self.position.rsplit(':', 2)
pt = self.view.text_point(int(line) - 1, int(column))
region_name = 'anaconda.indicator.{}.{}'.format(
self.view.id(), line
)
for i in range(3):
delta = 300 * i * 2
sublime.set_timeout(lambda: self.view.add_regions(
region_name,
[sublime.Region(pt, pt)],
'comment',
'bookmark',
sublime.DRAW_EMPTY_AS_OVERWRITE
), delta)
sublime.set_timeout(
lambda: self.view.erase_regions(region_name),
delta + 300
)
python类DRAW_EMPTY_AS_OVERWRITE的实例源码
def _toggle_indicator(self, lineno: int =0, columno: int =0) -> None:
"""Toggle mark indicator for focus the cursor
"""
pt = self.text.view.text_point(lineno - 1, columno)
region_name = 'anaconda.indicator.{}.{}'.format(
self.text.view.id(), lineno
)
for i in range(3):
delta = 300 * i * 2
sublime.set_timeout(lambda: self.text.view.add_regions(
region_name,
[sublime.Region(pt, pt)],
'comment',
'bookmark',
sublime.DRAW_EMPTY_AS_OVERWRITE
), delta)
sublime.set_timeout(
lambda: self.text.view.erase_regions(region_name),
delta + 300
)
def add_lint_marks(view, lines, **errors):
"""Adds lint marks to view on the given lines.
"""
erase_lint_marks(view)
types = {
'warning': errors['warning_underlines'],
'illegal': errors['error_underlines'],
'violation': errors['violation_underlines'],
}
style = get_settings(view, 'anaconda_linter_mark_style', 'outline')
show_underlines = get_settings(view, 'anaconda_linter_underlines', True)
if show_underlines:
for type_name, underlines in types.items():
if len(underlines) > 0:
view.add_regions(
'anaconda-lint-underline-{}'.format(type_name), underlines,
'anaconda.underline.{}'.format(type_name),
flags=sublime.DRAW_EMPTY_AS_OVERWRITE
)
if len(lines) > 0:
outline_style = {
'solid_underline': sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE | sublime.DRAW_SOLID_UNDERLINE,
'stippled_underline': sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE | sublime.DRAW_STIPPLED_UNDERLINE,
'squiggly_underline': sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE | sublime.DRAW_SQUIGGLY_UNDERLINE,
'outline': sublime.DRAW_OUTLINED,
'none': sublime.HIDDEN,
'fill': None
}
gutter_theme = get_settings(
view, 'anaconda_gutter_theme', 'basic').lower()
package_name = os.path.dirname(__file__).rsplit(os.path.sep, 3)[1]
ico_path = (
'Packages/' + package_name + '/anaconda_lib/linting/'
'gutter_mark_themes/{theme}-{type}.png'
)
for lint_type, lints in get_outlines(view).items():
if len(lints) > 0:
if get_settings(view, 'anaconda_gutter_marks', False):
if gutter_theme == 'basic':
gutter_marks = marks[lint_type]
else:
gutter_marks = ico_path.format(theme=gutter_theme,
type=lint_type)
else:
gutter_marks = ''
args = [
'anaconda-lint-outlines-{}'.format(lint_type),
lints,
'anaconda.outline.{}'.format(lint_type),
gutter_marks
]
draw_style = outline_style.get(style, sublime.DRAW_OUTLINED)
if draw_style is not None:
args.append(draw_style)
view.add_regions(*args)