def run(self, commands): window = self.window view = window.active_view() tex_root = get_tex_root(view) ana = analysis.analyze_document(tex_root) entries = ana.filter_commands(commands, flags=analysis.ALL_COMMANDS) captions = [_make_caption(ana, e) for e in entries] quickpanel.show_quickpanel(captions, entries)
def run(self, commands, only_current_file=False): window = self.window view = window.active_view() tex_root = get_tex_root(view) ana = analysis.analyze_document(tex_root) entries = ana.filter_commands(commands, flags=analysis.ALL_COMMANDS) if only_current_file: file_name = view.file_name() entries = [e for e in entries if e.file_name == file_name] captions = [_make_caption(ana, e) for e in entries] quickpanel.show_quickpanel(captions, entries)
def _show_usage_label(view, args): tex_root = get_tex_root(view) if tex_root is None: return False ana = analysis.analyze_document(tex_root) def is_correct_ref(c): command = ("\\" + c.command + "{")[::-1] return NEW_STYLE_REF_REGEX.match(command) and c.args == args refs = ana.filter_commands(is_correct_ref) if len(refs) == 0: sublime.error_message("No references for '{0}' found.".format(args)) return elif len(refs) == 1: ref = refs[0] utils.open_and_select_region(view, ref.file_name, ref.region) return captions = [ana_utils.create_rel_file_str(ana, r) for r in refs] quickpanel.show_quickpanel(captions, refs)