diff --git a/boot.py b/boot.py index e485656..1b1d110 100644 --- a/boot.py +++ b/boot.py @@ -1,22 +1,12 @@ -def plugin_reload() -> None: +def reload_plugin() -> None: import sys + # Remove all previously loaded plugin modules. prefix = f"{__package__}." for module_name in tuple(filter(lambda m: m.startswith(prefix) and m != __name__, sys.modules)): del sys.modules[module_name] -plugin_reload() +reload_plugin() -from .plugin import set_up -from .plugin import tear_down -from .plugin.FollowLnk import * # noqa: F401, F403 -import sublime - - -def plugin_loaded() -> None: - sublime.set_timeout_async(set_up) - - -def plugin_unloaded() -> None: - tear_down() +from .plugin import * # noqa: F401, F403 diff --git a/plugin/__init__.py b/plugin/__init__.py index 5539273..5daf38b 100644 --- a/plugin/__init__.py +++ b/plugin/__init__.py @@ -1,8 +1,18 @@ -def set_up() -> None: - """plugin_loaded""" +# import all listeners and commands +from .listener import FollowLnkViewEventListener + +__all__ = ( + # ST: core + "plugin_loaded", + "plugin_unloaded", + # ST: listeners + "FollowLnkViewEventListener", +) + + +def plugin_loaded() -> None: pass -def tear_down() -> None: - """plugin_unloaded""" +def plugin_unloaded() -> None: pass diff --git a/plugin/FollowLnk.py b/plugin/listener.py similarity index 96% rename from plugin/FollowLnk.py rename to plugin/listener.py index 99d3d02..368f3af 100644 --- a/plugin/FollowLnk.py +++ b/plugin/listener.py @@ -8,7 +8,7 @@ PACKAGE_NAME = __package__.partition(".")[0] -class FollowLnk(sublime_plugin.ViewEventListener): +class FollowLnkViewEventListener(sublime_plugin.ViewEventListener): @classmethod def is_applicable(cls, settings: sublime.Settings) -> bool: return sublime.platform() == "windows"