-
Notifications
You must be signed in to change notification settings - Fork 1
/
plugin.py
35 lines (28 loc) · 1.17 KB
/
plugin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""Load and Unload all MarkdownEditing modules.
This module exports __all__ modules, which Sublime Text needs to know about.
Based on the plugin.py in the MarkdownEditing package:
https://github.com/SublimeText-Markdown/MarkdownEditing/blob/master/plugin.py
"""
from pathlib import Path
import sublime
import sublime_plugin
if int(sublime.version()) < 3176:
print(__package__ + " requires ST3 3176+")
else:
import sys
# clear modules cache if package is reloaded (after update?)
prefix = __package__ + "." # don't clear the base package
for module_name in [
module_name for module_name in sys.modules if module_name.startswith(prefix) and module_name != __name__
]:
del sys.modules[module_name]
prefix = None
# import all published Commands and EventListeners
from .plugins.check_justfile_build import CheckJustfileBuildCommand
class TouchPluginPyCommand(sublime_plugin.WindowCommand):
def run(self):
variables = self.window.extract_variables()
path = Path(variables["file"])
plugin = Path(variables["project_path"]) / "plugin.py"
if plugin != path and path.suffix == ".py":
plugin.touch()