def run(self, dir=''): if not dir: view = self.window.active_view() dir = gs.basedir_or_cwd( view.file_name() if view is not None else None) gsq.dispatch('*', lambda: show_pkgfiles(dir), 'scanning directory for package files')
def run(self, edit): if gs.setting('comp_lint_enabled') is not True: return fn = self.view.file_name() fn = os.path.abspath(fn) if fn: dirname = gs.basedir_or_cwd(fn) file_refs[fn] = FileRef(self.view) gsq.dispatch(CL_DOMAIN, lambda: do_comp_lint(dirname, fn), '')
def run(self, dir=''): o = kv.O(cancelled=False) def cancel(): o.cancelled = True if not dir: view = self.window.active_view() dir = gs.basedir_or_cwd(view.file_name() if view is not None else None) gsq.do(DOMAIN, lambda: show_pkgfiles(dir, o), 'scanning directory for package files', cancel=cancel)
def __init__(self, cmd=[], shell=False, env={}, cwd=None, view=None): self.view = view super(ViewCommand, self).__init__(cmd=cmd, shell=shell, env=env, cwd=cwd) self.output_done = [] self.show_summary = False if not self.cwd and view is not None: try: self.cwd = gs.basedir_or_cwd(view.file_name()) except Exception: self.cwd = None
def _complete_opts(fn, src, pos): home = gs.home_path() builtins = gs.setting("autocomplete_builtins") is True or gs.setting("complete_builtins") is True return { "Dir": gs.basedir_or_cwd(fn), "Builtins": builtins, "Fn": fn or "", "Src": src or "", "Pos": pos or 0, "Home": home, "Env": gs.env({"XDG_CONFIG_HOME": home}), }
def _complete_opts(fn, src, pos, builtins): nv = sh.env() return { "Dir": gs.basedir_or_cwd(fn), "Builtins": builtins, "Fn": fn or "", "Src": src or "", "Pos": pos or 0, "Home": sh.vdir(), "Autoinst": gs.setting("autoinst"), "InstallSuffix": gs.setting("installsuffix", ""), "Env": {"GOROOT": nv.get("GOROOT", ""), "GOPATH": nv.get("GOPATH", "")}, }
def _complete_opts(fn, src, pos): home = gs.home_path() builtins = (gs.setting('autocomplete_builtins') is True or gs.setting('complete_builtins') is True) return { 'Dir': gs.basedir_or_cwd(fn), 'Builtins': builtins, 'Fn': fn or '', 'Src': src or '', 'Pos': pos or 0, 'Home': home, 'Env': gs.env({ 'XDG_CONFIG_HOME': home, }), }
def run(self): pkg_name = "main" view = gs.active_valid_go_view() try: basedir = gs.basedir_or_cwd(view and view.file_name()) for fn in os.listdir(basedir): if fn.endswith(".go"): name, _ = mg9.pkg_name(os.path.join(basedir, fn), "") if name: pkg_name = name break except Exception: gs.error_traceback("GsNewGoFile") self.window.new_file().run_command("gs_create_new_go_file", {"pkg_name": pkg_name, "file_name": "main.go"})
def run(self, dir=''): o = kv.O(cancelled=False) def cancel(): o.cancelled = True if not dir: view = self.window.active_view() dir = gs.basedir_or_cwd( view.file_name() if view is not None else None) gsq.do(DOMAIN, lambda: show_pkgfiles(dir, o), 'scanning directory for package files', cancel=cancel)
def _complete_opts(fn, src, pos, builtins): nv = sh.env() return { 'Dir': gs.basedir_or_cwd(fn), 'Builtins': builtins, 'Fn': fn or '', 'Src': src or '', 'Pos': pos or 0, 'Home': sh.vdir(), 'Autoinst': gs.setting('autoinst'), 'Env': { 'GOROOT': nv.get('GOROOT', ''), 'GOPATH': nv.get('GOPATH', ''), }, }
def _complete_opts(fn, src, pos, builtins): nv = sh.env() return { 'Dir': gs.basedir_or_cwd(fn), 'Builtins': builtins, 'Fn': fn or '', 'Src': src or '', 'Pos': pos or 0, 'Home': sh.vdir(), 'Autoinst': gs.setting('autoinst'), 'InstallSuffix': gs.setting('installsuffix', ''), 'Env': { 'GOROOT': nv.get('GOROOT', ''), 'GOPATH': nv.get('GOPATH', ''), }, }
def complete(fn, src, pos): home = gs.home_path() builtins = (gs.setting('autocomplete_builtins') is True or gs.setting('complete_builtins') is True) res, err = bcall('gocode_complete', { 'Dir': gs.basedir_or_cwd(fn), 'Builtins': builtins, 'Fn': fn or '', 'Src': src or '', 'Pos': pos or 0, 'Home': home, 'Env': gs.env({ 'XDG_CONFIG_HOME': home, }), }) res = gs.dval(res.get('completions'), []) return res, err
def run(self): pkg_name = 'main' view = gs.active_valid_go_view() try: basedir = gs.basedir_or_cwd(view and view.file_name()) for fn in os.listdir(basedir): if fn.endswith('.go'): name, _ = mg9.pkg_name(os.path.join(basedir, fn), '') if name: pkg_name = name break except Exception: gs.error_traceback('GsNewGoFile') self.window.new_file().run_command('gs_create_new_go_file', { 'pkg_name': pkg_name, 'file_name': 'main.go', })
def _complete_opts(fn, src, pos, builtins, *, forceInstall=False): nv = sh.env() return { 'Dir': gs.basedir_or_cwd(fn), 'Builtins': builtins, 'Fn': fn or '', 'Src': src or '', 'Pos': pos or 0, 'Home': sh.vdir(), 'Autoinst': gs.setting('autoinst'), 'InstallSuffix': gs.setting('installsuffix', ''), 'Env': { 'GOROOT': nv.get('GOROOT', ''), 'GOPATH': nv.get('GOPATH', ''), 'TEMP': nv.get('TEMP', ''), 'TMP': nv.get('TMP', ''), 'FORCE_INSTALL': str(int(forceInstall)), }, }
def _complete_opts(fn, src, pos, builtins, *, forceInstall = False): nv = sh.env() return { 'Dir': gs.basedir_or_cwd(fn), 'Builtins': builtins, 'Fn': fn or '', 'Src': src or '', 'Pos': pos or 0, 'Home': sh.vdir(), 'Autoinst': gs.setting('autoinst'), 'InstallSuffix': gs.setting('installsuffix', ''), 'Env': { 'GOROOT': nv.get('GOROOT', ''), 'GOPATH': nv.get('GOPATH', ''), 'TEMP': nv.get('TEMP', ''), 'TMP': nv.get('TMP', ''), 'FORCE_INSTALL': str(int(forceInstall)), }, }
def run(self, dir=''): if not dir: view = self.window.active_view() dir = gs.basedir_or_cwd(view.file_name() if view is not None else None) gsq.dispatch('*', lambda: show_pkgfiles(dir), 'scanning directory for package files')
def active_wd(win=None): _, v = gs.win_view(win=win) return gs.basedir_or_cwd(v.file_name() if v else '')
def cb(i, win): if i >= 0: dirname = gs.basedir_or_cwd(m[ents[i]]) win.run_command('gs_browse_files', {'dir': dirname})