def load_modules(obj, loaded): """ Load bracket plugin modules """ plib = obj.get("plugin_library") if plib is None: return try: module = ImportModule.import_module(plib, loaded) obj["compare"] = getattr(module, "compare", None) obj["post_match"] = getattr(module, "post_match", None) loaded.add(plib) except: bh_logging("Could not load module %s\n%s" % (plib, str(traceback.format_exc()))) raise
def load_modules(obj, loaded): """ Load bracket plugin modules """ plib = obj.get("plugin_library") if plib is None: return try: module = ImportModule.import_module(plib, loaded) obj["compare"] = getattr(module, "compare", None) obj["post_match"] = getattr(module, "post_match", None) loaded.add(plib) except: bh_logging("BracketHighlighter: Could not load module %s" % plib) raise
import sublime from bh_plugin import ImportModule as ImpMod BracketRemove = ImpMod.import_from("bh_modules.bracketremove", "BracketRemove") class SwapBrackets(BracketRemove): def run(self, edit, name, remove_content=False, remove_indent=False, remove_block=False): offset = self.left.toregion().size() selection = [sublime.Region(self.left.begin, self.right.begin - offset)] left = self.left.move(self.left.end, self.left.end) right = self.right.move(self.right.begin, self.right.begin) super(SwapBrackets, self).run(edit, name) self.selection = selection self.left = left self.right = right self.nobracket = False def plugin(): return SwapBrackets
import sublime from bh_plugin import ImportModule as ImpMod BracketRemove = ImpMod.import_from("bh_modules.bracketremove", "BracketRemove") class SwapBrackets(BracketRemove): def run(self, edit, name, remove_content=False, remove_indent=False, remove_block=False): offset = self.left.toregion().size() self.selection = [sublime.Region(self.left.begin, self.right.begin - offset)] super(SwapBrackets, self).run(edit, name) def plugin(): return SwapBrackets