资源简介
Package+Control;打开Sublime Text 3,选择菜单:Preference-->Browse Package... 浏览插件,将下载的文件覆盖到该目录下
代码片段和文件信息
import os
import sys
import sublime
import sublime_plugin
if sys.version_info >= (3):
import importlib
import zipimport
st_build = int(sublime.version())
mod_prefix = ‘package_control‘
# ST3 loads each package as a module so it needs an extra prefix
if sys.version_info >= (3):
bare_mod_prefix = mod_prefix
mod_prefix = ‘Package Control.‘ + mod_prefix
from imp import reload
# When reloading the package we also need to reload the base “package_control“
# module in ST3. This flag inidicates we should re-add the PC package path
# to the beginning of sys.path before we try to reload.
do_insert = False
is_zipped = False
commands_name = mod_prefix + ‘.commands‘
if commands_name in sys.modules and sys.version_info >= (3) and st_build < 3112:
# Unfortunately with ST3 the ZipLoader does not “properly“
# implement load_module() instead loading the code from the zip
# file when the object is instantiated. This means that calling
# reload() by itself does nothing. Instead we have to refresh the
# actual source code and then call reload().
pc_package_path = os.path.dirname(__file__)
if pc_package_path.endswith(‘.sublime-package‘):
refreshing_zip_loader = sublime_plugin.ZipLoader(pc_package_path)
pc_zip_loader = sys.modules[commands_name].__loader__
if hasattr(pc_zip_loader ‘contents‘) and hasattr(pc_zip_loader ‘packages‘):
pc_zip_loader.contents = refreshing_zip_loader.contents
pc_zip_loader.packages = refreshing_zip_loader.packages
if pc_package_path in zipimport._zip_directory_cache:
del zipimport._zip_directory_cache[pc_package_path]
is_zipped = True
importlib.invalidate_caches()
do_insert = True
# Python allows reloading modules on the fly which allows us to do live upgrades.
# The only caveat to this is that you have to reload in the dependency order.
#
# Thus is module A depends on B and we don‘t reload B before A when A is reloaded
# it will still have a reference to the old B. Thus we hard-code the dependency
# order of the various Package Control modules so they get reloaded properly.
#
# There are solutions for doing this all programatically but this is much easier
# to understand.
reload_mods = []
for mod in sys.modules:
if mod[0:15] in set([‘package_control‘ ‘Package Control‘]) and sys.modules[mod] is not None:
reload_mods.append(mod)
mods_load_order = [
‘‘
‘.sys_path‘
‘.text‘
‘.cache‘
‘.file_not_found_error‘
‘.open_compat‘
‘.http_cache‘
‘.console_write‘
‘.unicode‘
‘.clear_directory‘
‘.show_error‘
‘.cmd‘
‘.processes‘
‘.settings‘
‘.show_quick_panel‘
‘.thread_progress‘
‘.package_io‘
‘.semver‘
‘.versions‘
‘.deps.asn1crypto._errors‘
‘.deps.asn1crypto._ffi‘
‘.deps.asn1crypto._int‘
‘.deps.asn1crypto._elliptic_curve‘
‘.deps.asn1crypto._types‘
‘.deps.asn1crypto._inet
- 上一篇:英语培训静态页面
- 下一篇:KF_Altitude
相关资源
- Sublime Text3带全插件版和纯净版
- GBK Encoding Support
- source insight4.0 仿sublime text 配色方案
- Markdown安装报错解决文件
- channel_v3.json及详细操作步骤
- sourceInsigit4.0sublime配色文件
- Sublime Text 3最新emmet插件
- pyv8-win64-p3-emmet所需文件.zip
- sublime-text_build-3211_amd64.deb
- sublime_package_control-master.zip
- source insight sublime text 颜色配置文件
- soucre insight 的 sublime text 配色配置文件
- Keil5配色方案,仿sublime3
- Markdown.sublime-syntax
- Package Control.sublime-package-汉化Sublime
- sublime text3最新版豆沙绿护眼主题
- darktheme+Sublime Text2 配色方案
- Package Control.sublime-package24671
- ctags插件地址亲测可用
- sublime text3 护眼主题
- 微信小程序sublime插件tc-weapp-snippets-
- Package Control.sublime-package
- vs2015使用sublime-monokai主题
- IMESupport-master插件
评论
共有 条评论