def do_sync_active_view(view): fn = view.file_name() if fn: gs.set_attr('last_active_fn', fn) if fn.lower().endswith('.go'): gs.set_attr('last_active_go_fn', fn) if gs.is_pkg_view(view): m = {} psettings = view.settings().get('GoSublime') if psettings and gs.is_a(psettings, {}): m = gs.mirror_settings(psettings) gs.set_attr('last_active_project_settings', gs.dval(m, {}))
def do_post_save(view): if not gs.is_pkg_view(view): return for c in gs.setting("on_save", []): cmd = c.get("cmd", "") args = c.get("args", {}) msg = "running on_save command %s" % cmd tid = gs.begin(DOMAIN, msg, set_status=False) try: view.run_command(cmd, args) except Exception as ex: gs.notice(DOMAIN, "Error %s" % ex) finally: gs.end(tid)
def do_post_save(view): if not gs.is_pkg_view(view): return for c in gs.setting('on_save', []): cmd = c.get('cmd', '') args = c.get('args', {}) msg = 'running on_save command %s' % cmd tid = gs.begin(DOMAIN, msg, set_status=False) try: view.run_command(cmd, args) except Exception as ex: gs.notice(DOMAIN, 'Error %s' % ex) finally: gs.end(tid)
def do_post_save(view): if not gs.is_pkg_view(view): return domain = 'GoSublime-On-Save' for c in gs.setting('on_save', []): cmd = c.get('cmd', '') args = c.get('args', {}) msg = 'running on_save command %s' % cmd tid = gs.begin(domain, msg, set_status=False) gs.println(msg) try: view.run_command(cmd, args) except Exception as ex: gs.notice(domain, 'Error %s' % ex) finally: gs.end(tid)
def run(self): view = self.window.active_view() args = {'run': '^1'} if gs.is_pkg_view(view) else {} view.run_command('gs9o_open', args)