def update_diagnostics_phantoms(view: sublime.View, diagnostics: 'List[Diagnostic]'):
global phantom_sets_by_buffer
buffer_id = view.buffer_id()
if not show_diagnostics_phantoms or view.is_dirty():
phantoms = None
else:
phantoms = list(
create_phantom(view, diagnostic) for diagnostic in diagnostics)
if phantoms:
phantom_set = phantom_sets_by_buffer.get(buffer_id)
if not phantom_set:
phantom_set = sublime.PhantomSet(view, "lsp_diagnostics")
phantom_sets_by_buffer[buffer_id] = phantom_set
phantom_set.update(phantoms)
else:
phantom_sets_by_buffer.pop(buffer_id, None)
评论列表
文章目录