def show_tooltip(self, view: sublime.View, tooltip: str, content: Dict[str, str], fallback: Callable) -> None: # noqa
"""Generates and display a tooltip or pass execution to fallback
"""
st_ver = int(sublime.version())
if st_ver < 3070:
return fallback()
width = get_settings(view, 'font_size', 8) * 75
kwargs = {'location': -1, 'max_width': width if width < 900 else 900}
if st_ver >= 3071:
kwargs['flags'] = sublime.COOPERATE_WITH_AUTO_COMPLETE
text = self._generate(tooltip, content)
if text is None:
return fallback()
return view.show_popup(text, **kwargs)
评论列表
文章目录