def wrapper(func): view = window.active_view() filename = view.file_name() if filename is None: sublime.error_message('Cannot use GNU GLOBAL for non-file') return if dir is None: tags_root = gtags.find_tags_root(filename) if tags_root is None: sublime.error_message("GTAGS not found. build tags by 'gtags'") return else: tags_root = dir[0] func(view, create_tags(tags_root))
def wrapper(func): view = window.active_view() filename = view.file_name() if filename is None: sublime.error_message('Cannot use GNU GLOBAL for non-file') return if dir is None: tags_root = find_tags_root(dirname(filename)) if tags_root is None: sublime.error_message("GTAGS not found. build tags by 'gtags'") return else: tags_root = dir[0] tags = TagFile(tags_root, get_settings().get('extra_tag_paths')) func(view, tags, tags_root)
def on_post_save(self, view): if not load_settings().get('update_on_save'): return file_name = view.file_name() if not os.access(file_name, os.W_OK): return tags_root = gtags.find_tags_root(file_name) if tags_root is not None: tags = create_tags(tags_root) if not tags.is_single_update_supported(): print ('Incremental single file update is not supported' + ' ' + 'until GNU GLOBAL v%s. You have GNU GLOBAL v%s.') % ( gtags.GLOBAL_SINGLE_UPDATE_ARRIVAL_VERSION, tags.version()) return thread = AutoUpdateThread(tags, file_name) thread.start() ThreadProgress(thread, 'Updating tags for %s' % file_name, 'Tags updated successfully for %s' % file_name, 'Error while tags updating, see console for details')
def run(self): file_name = sublime.active_window().active_view().file_name() if file_name: tags_root = gtags.find_tags_root(file_name) if tags_root is not None: dispatcher().jump_history(tags_root).jump_back()