def update_index(self, view, colors): """Code to run.""" try: colors.sort() sublime.status_message('File color index complete...') view.settings().set('color_helper_file_palette', colors) util.debug('Colors:\n', colors) except Exception: pass
def start_file_index(view): """Kick off current file color index.""" global ch_file_thread if view is not None and (ch_file_thread is None or not ch_file_thread.is_alive()): scope = util.get_scope(view, skip_sel_check=True) if scope: source = [] for r in view.find_by_selector(scope): source.append(view.substr(r)) util.debug('Regions to search:\n', source) if len(source): ch_file_thread = ChFileIndexThread(view, ' '.join(source)) ch_file_thread.start() sublime.status_message('File color indexer started...')