def show_phantoms(self, view):
"""Show phantoms for compilation errors.
Args:
view (sublime.View): current view
"""
view.erase_phantoms(PopupErrorVis._TAG)
if view.buffer_id() not in self.phantom_sets:
phantom_set = sublime.PhantomSet(view, PopupErrorVis._TAG)
self.phantom_sets[view.buffer_id()] = phantom_set
else:
phantom_set = self.phantom_sets[view.buffer_id()]
phantoms = []
current_error_dict = self.err_regions[view.buffer_id()]
for err in current_error_dict:
errors_dict = current_error_dict[err]
errors_html = PhantomErrorVis._as_html(errors_dict)
pt = view.text_point(err - 1, 1)
phantoms.append(sublime.Phantom(
sublime.Region(pt, view.line(pt).b),
errors_html,
sublime.LAYOUT_BELOW,
on_navigate=self._on_phantom_navigate))
phantom_set.update(phantoms)
评论列表
文章目录