def run(self): def f(res, err): if err: gs.notify(DOMAIN, err) return mats = {} args = {} decls = res.get("file_decls", []) decls.extend(res.get("pkg_decls", [])) for d in decls: name = d["name"] prefix, _ = match_prefix_name(name) kind = d["kind"].lstrip("+- ") if prefix and kind == "func" and d["repr"] == "": mats[prefix] = True args[name] = name names = sorted(args.keys()) ents = ["Run all tests and examples"] for k in ["Test", "Benchmark", "Example"]: if mats.get(k): s = "Run %ss Only" % k ents.append(s) if k == "Benchmark": args[s] = ["-test.run=none", '-test.bench="%s.*"' % k] else: args[s] = ['-test.run="%s.*"' % k] for k in names: ents.append(k) if k.startswith("Benchmark"): args[k] = ["-test.run=none", '-test.bench="^%s$"' % k] else: args[k] = ['-test.run="^%s$"' % k] def cb(i, win): if i >= 0: a = args.get(ents[i], []) win.active_view().run_command( "gs9o_open", {"run": gs.lst("go", "test", a)} ) gs.show_quick_panel(ents, cb) win, view = gs.win_view(None, self.window) if view is None: return vfn = gs.view_fn(view) src = gs.view_src(view) pkg_dir = "" if view.file_name(): pkg_dir = os.path.dirname(view.file_name()) mg9.declarations(vfn, src, pkg_dir, f)
def run(self): def f(res, err): if err: gs.notify(DOMAIN, err) return mats = {} args = {} decls = res.get('file_decls', []) decls.extend(res.get('pkg_decls', [])) for d in decls: name = d['name'] prefix, _ = match_prefix_name(name) kind = d['kind'].lstrip('+-~ ') if prefix and kind == 'func' and d['repr'] == '': mats[prefix] = True args[name] = name names = sorted(args.keys()) ents = ['Run all tests and examples'] for k in ['Test', 'Benchmark', 'Example']: if mats.get(k): s = 'Run %ss Only' % k ents.append(s) if k == 'Benchmark': args[s] = ['-test.run=none', '-test.bench="%s.*"' % k] else: args[s] = ['-test.run="%s.*"' % k] for k in names: ents.append(k) if k.startswith('Benchmark'): args[k] = ['-test.run=none', '-test.bench="^%s$"' % k] else: args[k] = ['-test.run="^%s$"' % k] def cb(i, win): if i >= 0: a = args.get(ents[i], []) win.active_view().run_command('gs9o_open', {'run': gs.lst('go', 'test', a)}) gs.show_quick_panel(ents, cb) win, view = gs.win_view(None, self.window) if view is None: return vfn = gs.view_fn(view) src = gs.view_src(view) pkg_dir = '' if view.file_name(): pkg_dir = os.path.dirname(view.file_name()) mg9.declarations(vfn, src, pkg_dir, f)
def run(self): def f(res, err): if err: gs.notify(DOMAIN, err) return mats = {} args = {} decls = res.get('file_decls', []) decls.extend(res.get('pkg_decls', [])) for d in decls: name = d['name'] prefix, _ = match_prefix_name(name) if prefix and d['kind'] == 'func' and d['repr'] == '': mats[prefix] = True args[name] = name names = sorted(args.keys()) ents = ['Run all tests and examples'] for k in ['Test', 'Benchmark', 'Example']: if mats.get(k): s = 'Run %ss Only' % k ents.append(s) if k == 'Benchmark': args[s] = ['-test.run=none', '-test.bench="%s.*"' % k] else: args[s] = ['-test.run="%s.*"' % k] for k in names: ents.append(k) if k.startswith('Benchmark'): args[k] = ['-test.run=none', '-test.bench="^%s$"' % k] else: args[k] = ['-test.run="^%s$"' % k] def cb(i, win): if i >= 0: a = args.get(ents[i], []) win.active_view().run_command('gs9o_open', {'run': gs.lst('go', 'test', a)}) gs.show_quick_panel(ents, cb) win, view = gs.win_view(None, self.window) if view is None: return vfn = gs.view_fn(view) src = gs.view_src(view) pkg_dir = '' if view.file_name(): pkg_dir = os.path.dirname(view.file_name()) mg9.declarations(vfn, src, pkg_dir, f)
def active_wd(win=None): _, v = gs.win_view(win=win) return gs.basedir_or_cwd(v.file_name() if v else '')
def run(self,debug=False): global w_builders g_builder=None wid=self.window.id() if w_builders.has_key(wid): g_builder=w_builders[wid] if (g_builder is not None) and (g_builder.is_running()): g_builder.showLView() return def f(res, err): if err: gs.notify(DOMAIN, err) return mats = {} args = {} decls = res.get('file_decls', []) decls.extend(res.get('pkg_decls', [])) for d in decls: name = d['name'] prefix, _ = match_prefix_name(name) if prefix and d['kind'] == 'func' and d['repr'] == '': mats[True] = prefix args[name] = name names = sorted(args.keys()) ents = ['Run all tests and examples'] for k in ['Test', 'Benchmark', 'Example']: if mats.get(k): s = 'Run %ss Only' % k ents.append(s) if k == 'Benchmark': args[s] = ['-test.run=none', '-test.bench="%s.*"' % k] else: args[s] = ['-test.run="%s.*"' % k] for k in names: ents.append(k) if k.startswith('Benchmark'): args[k] = ['-test.run=none', '-test.bench="^%s$"' % k] else: args[k] = ['-test.run=^%s$' % k] def cb(i, win): if i >= 0: a = args.get(ents[i], []) sargs="" if len(a)>0: sargs=a[0] # print sargs if debug: win.run_command('gdb_launch', {'test':True,'trun':sargs}) else: global g_builder g_builder=GoBuilder() g_builder.initEnv(True,sargs,self.window.active_view(),n_console_view) g_builder.run() gs.show_quick_panel(ents, cb) win, view = gs.win_view(None, self.window) if view is None: return vfn = gs.view_fn(view) src = gs.view_src(view) pkg_dir = '' if view.file_name(): pkg_dir = os.path.dirname(view.file_name()) mg9.declarations(vfn, src, pkg_dir, f)
def run(self, debug=False): global w_builders g_builder = None wid = self.window.id() if w_builders.has_key(wid): g_builder = w_builders[wid] if (g_builder is not None) and (g_builder.is_running()): g_builder.showLView() return def f(res, err): if err: gs.notify(DOMAIN, err) return mats = {} args = {} decls = res.get('file_decls', []) decls.extend(res.get('pkg_decls', [])) for d in decls: name = d['name'] prefix, _ = match_prefix_name(name) if prefix and d['kind'] == 'func' and d['repr'] == '': mats[True] = prefix args[name] = name names = sorted(args.keys()) ents = ['Run all tests and examples'] for k in ['Test', 'Benchmark', 'Example']: if mats.get(k): s = 'Run %ss Only' % k ents.append(s) if k == 'Benchmark': args[s] = ['-test.run=none', '-test.bench="%s.*"' % k] else: args[s] = ['-test.run="%s.*"' % k] for k in names: ents.append(k) if k.startswith('Benchmark'): args[k] = ['-test.run=none', '-test.bench="^%s$"' % k] else: args[k] = ['-test.run=^%s$' % k] def cb(i, win): if i >= 0: a = args.get(ents[i], []) sargs = "" if len(a) > 0: sargs = a[0] # print sargs if debug: win.run_command('gdb_launch', { 'test': True, 'trun': sargs }) else: global g_builder g_builder = GoBuilder() g_builder.initEnv(True, sargs, self.window.active_view(), n_console_view) g_builder.run() gs.show_quick_panel(ents, cb) win, view = gs.win_view(None, self.window) if view is None: return vfn = gs.view_fn(view) src = gs.view_src(view) pkg_dir = '' if view.file_name(): pkg_dir = os.path.dirname(view.file_name()) mg9.declarations(vfn, src, pkg_dir, f)