def toggle_import(a): view, decl = a im, err = mg9.imports(view.file_name(), view.substr(sublime.Region(0, view.size())), [decl]) if err: ui.error(DOMAIN, err) else: src = im.get('src', '') line_ref = im.get('lineRef', 0) r = view.full_line(view.text_point(max(0, line_ref - 1), 0)) if not src or line_ref < 1 or not r: return view.run_command( 'gs_patch_imports', { 'pos': r.end(), 'content': src, 'added_path': (decl.get('path') if decl.get('add') else '') })
def toggle_import(self, a): view, decl = a im, err = mg9.imports( view.file_name(), view.substr(sublime.Region(0, view.size())), [decl] ) if err: gs.notice(DOMAIN, err) else: src = im.get('src', '') line_ref = im.get('lineRef', 0) r = view.full_line(view.text_point(max(0, line_ref-1), 0)) if not src or line_ref < 1 or not r: return view.run_command('gs_patch_imports', { 'pos': r.end(), 'content': src, 'added_path': (decl.get('path') if decl.get('add') else '') })
def toggle_import(self, a): view, decl = a im, err = mg9.imports( view.file_name(), view.substr(sublime.Region(0, view.size())), [decl] ) if err: gs.notice(DOMAIN, err) else: src = im.get("src", "") line_ref = im.get("lineRef", 0) r = view.full_line(view.text_point(max(0, line_ref - 1), 0)) if not src or line_ref < 1 or not r: return view.run_command( "gs_patch_imports", { "pos": r.end(), "content": src, "added_path": (decl.get("path") if decl.get("add") else ""), }, )