Example #1
0
def is_bolt_module(view):

    possible_starts = ['define\(', 'test\(']

    js = view.file_name() != None and view.file_name().endswith('.js')
    if js:

        dep_region = regions.deps(view)
        inj_region = regions.injs(view)

        def is_prefix(x):
            pos = view.find(x, 0)
            return pos != None and pos.begin() < dep_region.begin()

        if (dep_region != None and inj_region != None and dep_region.begin() < inj_region.begin()):
            defns = filter(is_prefix, possible_starts)
            if len(defns) == 0:
                return False
            else:
                return True

    return False
Example #2
0
def deps(view):
    cursor = selection.point(view)
    return regions.deps(view).contains(cursor)
Example #3
0
File: write.py Project: boltjs/bolt
def _deps(view, edit, xs):
    region = regions.deps(view)
    view.replace(edit, region, _format_deps(xs))
Example #4
0
File: text.py Project: boltjs/bolt
def deps(view):
    region = regions.deps(view)
    return _region(view, region)