def delete_selection(view, edit): read_view = ui_read.all(view) plasmas = core_read.plasmas(read_view.ptext) plasma = plasma_selection.plasma(view, plasmas) if plasma != None: r = plist.remove(plasmas, plasma) _plasma_writer(view, edit)(r)
def run(view, handler): valid = lookup_file_type.is_bolt_module(view) if not valid: open_file = view.file_name() if view.file_name() != None else "-- no view" print "View is not a bolt module: " + open_file handler.cancel() else: read_view = ui_read.all(view) spots = read_spots.spots(view) plasmas = core_read.plasmas(read_view.ptext) def update_ui(highlights, module_wrong): def run(): regions = write_highlight.regions(view, highlights) module_region = [ui_regions.module_name(view)] if module_wrong else [] flag_info = zip(flags(), [regions.incorrect, regions.missing, regions.unused, module_region]) def highlight_flag(x): if len(x[1]) > 0: write_highlight.highlight(view, x[1], x[0]), else: write_highlight.remove_highlight(view, x[0]) map(highlight_flag, flag_info) sublime.set_timeout(run, 0) thread = GeneralThread(_highlighter(read_view, spots, plasmas, update_ui), handler.success, handler.failure) sublime.set_timeout(thread.start, 0) handler.init(thread)
def optimise(view, edit): read_view = ui_read.all(view) spots = read_spots.spots(view) plasmas = core_read.plasmas(read_view.ptext) unused = analyse.unused(plasmas, spots) optimised = plist.remove_all(plasmas, unused) ui_write.plasmas(view, edit, plist.sort(optimised))
def _import_plasmas(view, read_view, token, done): init_plasmas = core_read.plasmas(read_view.ptext) existing = query_plasma.by_inj(init_plasmas, token) if (existing is None): def importer(dep): chosen = Plasma(dep, token) plasmas = plist.add(init_plasmas, chosen) done(plasmas) candidates = _find_candidates(read_view.base, token, read_view.nests) browse.list_if_needed(view, candidates, importer)
def goto_selection(view): read_view = ui_read.all(view) plasmas = core_read.plasmas(read_view.ptext) plasma = plasma_selection.plasma(view, plasmas) if plasma != None: _goto_module(view, plasma)