Example #1
0
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)
Example #2
0
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)
Example #3
0
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))
Example #4
0
def bolt_test(view, location):
    read_view = ui_read.all(view)
    nests = map(lambda n: read_view.base + '/' + n.base, read_view.nests)
    node = lookup_node.from_path(nests, location)

    def on_finish(name):
        gen_template(view, node, name, 'bolt_test_template', dict({
            'name': name
        }))

    pipeline = [
        TextPipe('Name ', lambda x, y: ''),
        FinishPipe(on_finish)
    ]
    chain.go(view.window(), pipeline)
Example #5
0
def import_token(view, edit, token):
    read_view = ui_read.all(view)
    _import_plasmas(view, read_view, token, _plasma_writer(view, edit))
Example #6
0
def import_selection(view, edit):
    read_view = ui_read.all(view)
    _import_plasmas(view, read_view, read_view.spot.token, _plasma_writer(view, edit))
Example #7
0
File: goto.py Project: boltjs/bolt
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)
Example #8
0
File: goto.py Project: boltjs/bolt
def _goto_module(view, plasma):
    read_view = ui_read.all(view)
    candidates = lookup_files.file_by_dep(read_view.base, plasma, read_view.nests)
    opener.file_list_open(view, candidates)