|
2 | 2 |
|
3 | 3 | This module exports __all__ modules, which Sublime Text needs to know about.
|
4 | 4 | """
|
5 |
| -import sublime |
| 5 | +__version__ = "3.5.0" |
6 | 6 |
|
7 |
| -if int(sublime.version()) < 3176: |
8 |
| - print(__package__ + " requires ST3 3176+") |
9 |
| -else: |
10 |
| - import sys |
| 7 | +import sys |
11 | 8 |
|
12 |
| - # clear modules cache if package is reloaded (after update?) |
13 |
| - prefix = __package__ + "." # don't clear the base package |
14 |
| - for module_name in [ |
15 |
| - module_name |
16 |
| - for module_name in sys.modules |
17 |
| - if module_name.startswith(prefix) and module_name != __name__ |
18 |
| - ]: |
19 |
| - del sys.modules[module_name] |
20 |
| - prefix = None |
| 9 | +# clear modules cache if package is reloaded (after update?) |
| 10 | +prefix = __spec__.parent + "." # don't clear the base package |
| 11 | +for module_name in [ |
| 12 | + module_name |
| 13 | + for module_name in sys.modules |
| 14 | + if module_name.startswith(prefix) and module_name != __spec__.name |
| 15 | +]: |
| 16 | + del sys.modules[module_name] |
| 17 | +del globals()["prefix"] |
| 18 | +del globals()["sys"] |
21 | 19 |
|
22 |
| - # import all published Commands and EventListeners |
23 |
| - from .plugins.bootstrap import ( |
24 |
| - on_after_install, |
25 |
| - on_before_uninstall, |
26 |
| - ) |
27 |
| - from .plugins.color_schemes import ( |
28 |
| - MdeSelectColorSchemeCommand, |
29 |
| - ) |
30 |
| - from .plugins.critic import ( |
31 |
| - MdeGotoNextCriticCommand, |
32 |
| - MdeGotoPrevCriticCommand |
33 |
| - ) |
34 |
| - from .plugins.folding import ( |
35 |
| - MdeAutoFoldListener, |
36 |
| - MdeFoldAllSectionsCommand, |
37 |
| - MdeFoldLinksCommand, |
38 |
| - MdeFoldSectionCommand, |
39 |
| - MdeShowFoldAllSectionsCommand, |
40 |
| - MdeUnfoldAllSectionsCommand, |
41 |
| - MdeUnfoldSectionCommand, |
42 |
| - ) |
43 |
| - from .plugins.footnotes import ( |
44 |
| - MdeGatherMissingFootnotesCommand, |
45 |
| - MdeGotoFootnoteDefinitionCommand, |
46 |
| - MdeGotoFootnoteReferenceCommand, |
47 |
| - MdeInsertFootnoteCommand, |
48 |
| - MdeMagicFootnotesCommand, |
49 |
| - MdeSortFootnotesCommand, |
50 |
| - MdeSwitchToFromFootnoteCommand, |
51 |
| - MdeMarkFootnotesListener, |
52 |
| - ) |
53 |
| - from .plugins.headings import ( |
54 |
| - MdeChangeHeadingsLevelCommand, |
55 |
| - MdeCompleteUnderlinedHeadingsCommand, |
56 |
| - MdeConvertUnderlinedHeadingsToAtxCommand, |
57 |
| - MdeFixUnderlinedHeadingsCommand, |
58 |
| - MdeGotoNextHeadingCommand, |
59 |
| - MdeGotoPreviousHeadingCommand, |
60 |
| - MdeMatchHeadingHashesCommand, |
61 |
| - MdeMatchHeadingHashesDetector, |
62 |
| - MdeUnsavedViewNameSetter, |
63 |
| - ) |
64 |
| - from .plugins.lists import ( |
65 |
| - MdeIndentListItemCommand, |
66 |
| - MdeUnindentListItemCommand, |
67 |
| - MdeNumberListCommand, |
68 |
| - MdeSwitchListBulletTypeCommand, |
69 |
| - MdeInsertTaskListItemCommand, |
70 |
| - MdeResetTaskListItemsCommand, |
71 |
| - MdeToggleTaskListItemCommand, |
72 |
| - MdeJoinLines, |
73 |
| - ) |
74 |
| - from .plugins.lint import ( |
75 |
| - MdeMarkdownLintCommand, |
76 |
| - MdeMarkdownLintMdlCommand, |
77 |
| - ) |
78 |
| - from .plugins.logging import ( |
79 |
| - load_logger, |
80 |
| - unload_logger |
81 |
| - ) |
82 |
| - from .plugins.quotes import ( |
83 |
| - MdeIndentQuote, |
84 |
| - MdeUnindentQuote, |
85 |
| - ) |
86 |
| - from .plugins.references import ( |
87 |
| - MdeConvertInlineLinksToReferencesCommand, |
88 |
| - MdeConvertInlineLinkToReferenceCommand, |
89 |
| - MdeGatherMissingLinkMarkersCommand, |
90 |
| - MdeReferenceDeleteReferenceCommand, |
91 |
| - MdeReferenceJumpCommand, |
92 |
| - MdeReferenceJumpContextCommand, |
93 |
| - MdeReferenceNewFootnoteCommand, |
94 |
| - MdeReferenceNewImageCommand, |
95 |
| - MdeReferenceNewInlineImageCommand, |
96 |
| - MdeReferenceNewInlineLinkCommand, |
97 |
| - MdeReferenceNewReferenceCommand, |
98 |
| - MdeReferenceOrganizeCommand, |
99 |
| - MdeAddNumberedReferenceDefinitionCommand, |
100 |
| - MdeReferenceCompletionsProvider, |
101 |
| - ) |
102 |
| - from .plugins.view import ( |
103 |
| - MdeReplaceSelectedCommand, |
104 |
| - MdeToggleCenteredLineCommand, |
105 |
| - MdeCenteredLineKeeper, |
106 |
| - ) |
107 |
| - from .plugins.wiki_page import ( |
108 |
| - MdeListBackLinksCommand, |
109 |
| - MdeMakePageReferenceCommand, |
110 |
| - MdeOpenHomePageCommand, |
111 |
| - MdeOpenJournalCommand, |
112 |
| - MdeOpenPageCommand, |
113 |
| - MdePrepareFromTemplateCommand, |
114 |
| - ) |
| 20 | +# import all published Commands and EventListeners |
| 21 | +from .plugins.color_schemes import ( |
| 22 | + MdeSelectColorSchemeCommand, |
| 23 | +) |
| 24 | +from .plugins.critic import ( |
| 25 | + MdeGotoNextCriticCommand, |
| 26 | + MdeGotoPrevCriticCommand |
| 27 | +) |
| 28 | +from .plugins.folding import ( |
| 29 | + MdeAutoFoldListener, |
| 30 | + MdeFoldAllSectionsCommand, |
| 31 | + MdeFoldLinksCommand, |
| 32 | + MdeFoldSectionCommand, |
| 33 | + MdeShowFoldAllSectionsCommand, |
| 34 | + MdeUnfoldAllSectionsCommand, |
| 35 | + MdeUnfoldSectionCommand, |
| 36 | +) |
| 37 | +from .plugins.footnotes import ( |
| 38 | + MdeGatherMissingFootnotesCommand, |
| 39 | + MdeGotoFootnoteDefinitionCommand, |
| 40 | + MdeGotoFootnoteReferenceCommand, |
| 41 | + MdeInsertFootnoteCommand, |
| 42 | + MdeMagicFootnotesCommand, |
| 43 | + MdeSortFootnotesCommand, |
| 44 | + MdeSwitchToFromFootnoteCommand, |
| 45 | + MdeMarkFootnotesListener, |
| 46 | +) |
| 47 | +from .plugins.headings import ( |
| 48 | + MdeChangeHeadingsLevelCommand, |
| 49 | + MdeCompleteUnderlinedHeadingsCommand, |
| 50 | + MdeConvertUnderlinedHeadingsToAtxCommand, |
| 51 | + MdeFixUnderlinedHeadingsCommand, |
| 52 | + MdeGotoNextHeadingCommand, |
| 53 | + MdeGotoPreviousHeadingCommand, |
| 54 | + MdeMatchHeadingHashesCommand, |
| 55 | + MdeMatchHeadingHashesDetector, |
| 56 | + MdeUnsavedViewNameSetter, |
| 57 | +) |
| 58 | +from .plugins.lists import ( |
| 59 | + MdeIndentListItemCommand, |
| 60 | + MdeUnindentListItemCommand, |
| 61 | + MdeNumberListCommand, |
| 62 | + MdeSwitchListBulletTypeCommand, |
| 63 | + MdeInsertTaskListItemCommand, |
| 64 | + MdeResetTaskListItemsCommand, |
| 65 | + MdeToggleTaskListItemCommand, |
| 66 | + MdeJoinLines, |
| 67 | +) |
| 68 | +from .plugins.lint import ( |
| 69 | + MdeMarkdownLintCommand, |
| 70 | + MdeMarkdownLintMdlCommand, |
| 71 | +) |
| 72 | +from .plugins.quotes import ( |
| 73 | + MdeIndentQuote, |
| 74 | + MdeUnindentQuote, |
| 75 | +) |
| 76 | +from .plugins.references import ( |
| 77 | + MdeConvertInlineLinksToReferencesCommand, |
| 78 | + MdeConvertInlineLinkToReferenceCommand, |
| 79 | + MdeGatherMissingLinkMarkersCommand, |
| 80 | + MdeReferenceDeleteReferenceCommand, |
| 81 | + MdeReferenceJumpCommand, |
| 82 | + MdeReferenceJumpContextCommand, |
| 83 | + MdeReferenceNewFootnoteCommand, |
| 84 | + MdeReferenceNewImageCommand, |
| 85 | + MdeReferenceNewInlineImageCommand, |
| 86 | + MdeReferenceNewInlineLinkCommand, |
| 87 | + MdeReferenceNewReferenceCommand, |
| 88 | + MdeReferenceOrganizeCommand, |
| 89 | + MdeAddNumberedReferenceDefinitionCommand, |
| 90 | + MdeReferenceCompletionsProvider, |
| 91 | +) |
| 92 | +from .plugins.view import ( |
| 93 | + MdeReplaceSelectedCommand, |
| 94 | + MdeToggleCenteredLineCommand, |
| 95 | + MdeCenteredLineKeeper, |
| 96 | +) |
| 97 | +from .plugins.wiki_page import ( |
| 98 | + MdeListBackLinksCommand, |
| 99 | + MdeMakePageReferenceCommand, |
| 100 | + MdeOpenHomePageCommand, |
| 101 | + MdeOpenJournalCommand, |
| 102 | + MdeOpenPageCommand, |
| 103 | + MdePrepareFromTemplateCommand, |
| 104 | +) |
115 | 105 |
|
116 |
| - def plugin_loaded(): |
117 |
| - def worker(): |
118 |
| - load_logger() |
119 |
| - on_after_install() |
120 | 106 |
|
121 |
| - sublime.set_timeout(worker, 10) |
| 107 | +def plugin_loaded(): |
| 108 | + def worker(): |
| 109 | + from .plugins.bootstrap import on_after_install |
| 110 | + from .plugins.logging import load_logger |
| 111 | + load_logger() |
| 112 | + on_after_install() |
122 | 113 |
|
123 |
| - def plugin_unloaded(): |
124 |
| - unload_logger() |
125 |
| - on_before_uninstall() |
| 114 | + from sublime import set_timeout |
| 115 | + set_timeout(worker, 100) |
| 116 | + |
| 117 | + |
| 118 | +def plugin_unloaded(): |
| 119 | + from .plugins.bootstrap import on_before_uninstall |
| 120 | + from .plugins.logging import unload_logger |
| 121 | + unload_logger() |
| 122 | + on_before_uninstall() |
0 commit comments