-
Notifications
You must be signed in to change notification settings - Fork 372
/
Copy pathplugin.py
163 lines (152 loc) · 5.08 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
import sublime
if int(sublime.version()) < 3143:
print(__package__ + " requires ST 3143+")
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]
from .latextools.utils.logging import logger, init_logger, shutdown_logger
from .latextools.auto_label import (
LatextoolsAutoInsertLabelCommand,
LatextoolsAutoInserLabelListener,
)
from .latextools.biblatex_crossref_completions import (
BiblatexCrossrefCompletions
)
from .latextools.biblatex_field_name_completions import (
FieldNameCompletions
)
from .latextools.biblatex_name_completions import (
BiblatexNameCompletions
)
from .latextools.biblatex_syntax_listener import (
BibLaTeXSyntaxListener
)
from .latextools.change_environment import (
LatextoolsChangeEnvironmentCommand,
LatextoolsToggleEnvironmentStarCommand,
)
from .latextools.context_provider import (
LatextoolsContextListener
)
from .latextools.delete_temp_files import (
LatextoolsClearCacheCommand,
LatextoolsClearLocalCacheCommand,
LatextoolsDeleteTempFilesCommand,
)
from .latextools.deprecated_command import (
LatextoolsFindDeprecatedCommandsCommand
)
from .latextools.detect_spellcheck import (
LatextoolsAutoDetectSpellcheckListener,
LatextoolsDetectSpellcheckCommand
)
from .latextools.jumpto_anywhere import (
LatextoolsJumptoAnywhereCommand,
LatextoolsJumptoAnywhereByMouseCommand
)
from .latextools.jumpto_pdf import (
LatextoolsJumptoPdfCommand,
LatextoolsViewPdfCommand,
)
from .latextools.jumpto_tex_file import (
LatextoolsJumptoFileCommand
)
from .latextools.latex_command import (
LatextoolsLatexCmdCommand
)
from .latextools.latex_command_completions import (
LatexCmdCompletion
)
from .latextools.latex_directive_completions import (
LatexDirectiveCompletion
)
from .latextools.latex_doc_viewer import (
LatextoolsPkgDocCommand,
LatextoolsViewDocCommand
)
from .latextools.latex_env import (
LatextoolsLatexEnvCommand
)
from .latextools.latex_env_closer import (
LatextoolsLatexEnvCloserCommand
)
from .latextools.latex_fill_all import (
LatexFillAllEventListener,
LatextoolsFillAllCommand,
LatexToolsFillAllCompleteBracket,
LatexToolsReplaceWord
)
from .latextools.latex_installed_packages import (
LatextoolsGenPkgCacheCommand
)
from .latextools.latextools_cache_listener import (
LatextoolsCacheUpdateListener,
LatextoolsAnalysisUpdateCommand,
LatextoolsBibcacheUpdateCommand,
)
from .latextools.make_pdf import (
LatextoolsMakePdfCommand,
LatextoolsDoOutputEditCommand,
LatextoolsDoFinishEditCommand,
LatextoolsExecEventListener,
)
from .latextools.migrate import (
LatextoolsMigrateCommand
)
from .latextools.preview import (
ImagePreviewHoverListener,
PreviewPhantomListener
)
from .latextools.reveal_folders import (
LatextoolsRevealAuxDirectoryCommand,
LatextoolsRevealOutputDirectoryCommand,
LatextoolsRevealTexRootDirectoryCommand
)
from .latextools.search_commands import (
LatextoolsSearchCommandCommand,
LatextoolsSearchCommandInputCommand
)
from .latextools.smart_paste import (
LatextoolsDownloadInsertImageHelperCommand,
LatextoolsSmartPasteCommand
)
from .latextools.system_check import (
LatextoolsSystemCheckCommand,
LatextoolsInsertTextCommand
)
from .latextools.tex_count import (
LatextoolsTexcountCommand
)
from .latextools.tex_syntax_listener import (
TeXSyntaxListener
)
from .latextools.toc_quickpanel import (
LatextoolsTocQuickpanelCommand,
LatextoolsTocQuickpanelContext
)
from .latextools.toggle_settings import (
LatextoolsToggleKeysCommand
)
def _filter_func(name):
return name.startswith(prefix) and name != __name__
def plugin_loaded():
init_logger()
for name in sorted(filter(_filter_func, sys.modules)):
module = sys.modules[name]
if hasattr(module, "latextools_plugin_loaded"):
logger.debug("calling %s.latextools_plugin_loaded()", name)
module.latextools_plugin_loaded()
def plugin_unloaded():
for name in sorted(filter(_filter_func, sys.modules)):
module = sys.modules[name]
if hasattr(module, "latextools_plugin_unloaded"):
logger.debug("calling %s.latextools_plugin_unloaded()", name)
module.latextools_plugin_unloaded()
shutdown_logger()