我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用sublime.COOPERATE_WITH_AUTO_COMPLETE。
def show_popup(self, symbol, symbolDescription): output = symbolDescription if getSetting('debug'): print(output) self.currentSymbol = symbol width, height = self.view.viewport_extent() output = self.formatPopup(output, symbol=symbol) # It seems sublime will core when the output is too long # In some cases the value can set to 76200, but we use a 65535 for safety. output = output[:65535] self.view.show_popup( output, flags=sublime.COOPERATE_WITH_AUTO_COMPLETE | sublime.HTML, location=-1, max_width=min(getSetting('popup_max_width'), width), max_height=min(getSetting('popup_max_height'), height - 100), on_navigate=self.on_navigate, on_hide=self.on_hide )
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)
def _render_impl(self, pfile, view, message): view.show_popup(message, sublime.COOPERATE_WITH_AUTO_COMPLETE, max_width=600, on_navigate=go_to_url)
def show_tooltip(self, view): """ show tooltip using mdpopups """ if not view.file_name(): return None tooltip = self.get_tooltip(view) if not tooltip: return None mdpopups.show_popup(view=view, content=tooltip, flags=sublime.COOPERATE_WITH_AUTO_COMPLETE, max_width=self.settings.get("tooltip_width", 1000), max_height=self.settings.get("height", 400), on_navigate=lambda label_id, view=view: utils.jump_to_label_declaration(view, tooltip))
def run(self, edit, event=None, symbol=None, force=False): global language, currentView view = self.view currentView = view pt = False language = getSetting('language') if not language: view.window().run_command('docphp_checkout_language') return if symbol == None: if event: pt = view.window_to_text((event["x"], event["y"])) else: pt = view.sel()[0] self.pt = pt symbol, locations = sublime_symbol.symbol_at_point(view, pt) translatedSymbol = symbol.replace('_', '-') # symbol = 'basename' translatedSymbol, symbolDescription = getSymbolDescription(translatedSymbol) if not symbolDescription: if getSetting('prompt_when_not_found'): view.show_popup('not found', sublime.COOPERATE_WITH_AUTO_COMPLETE) return return if getSetting('use_panel') == False: self.show_popup(translatedSymbol, symbolDescription) else: self.show_panel(translatedSymbol, symbolDescription, edit)