Sublime插件只有在我不重启Sublime Text 3时才有效

时间:2014-10-02 23:34:42

标签: python sublimetext sublimetext3 sublime-text-plugin

我正在尝试修复一个名为 reported bug 的插件的 ThemeAutomator ,但我不确定我得到了什么问题。

如果我print我加载的插件的sublime设置只能在首次运行安装时工作,或者当我保存ThemeAutomator.py时,基本上是sublime重新加载它然后它工作。方法load_settings无法加载正确的数据,为什么?

首先安装

print(sublime.load_settings('ThemeAutomator.sublime-settings').get('schemes')

返回[],一个准备填充的空数组,如果我使用插件,我会看到ThemeAutomator.sublime-settings正确填充{'extension': '.md', 'color_scheme': 'Packages/...

等数据

重新加载Sublime后

返回NoneType

这是完整的堆栈:

Traceback (most recent call last):
  File "/Applications/Coding/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 303, in on_activated
    callback.on_activated(v)
  File "ThemeAutomator in /Users/coop/Library/Application Support/Sublime Text 3/Installed Packages/ThemeAutomator.sublime-package", line 64, in on_activated
  File "ThemeAutomator in /Users/coop/Library/Application Support/Sublime Text 3/Installed Packages/ThemeAutomator.sublime-package", line 41, in add_scheme
AttributeError: 'NoneType' object has no attribute 'append'
found 12 files for base name Main.sublime-menu
Traceback (most recent call last):
  File "/Applications/Coding/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 319, in on_deactivated
    callback.on_deactivated(v)
  File "ThemeAutomator in /Users/coop/Library/Application Support/Sublime Text 3/Installed Packages/ThemeAutomator.sublime-package", line 69, in on_deactivated
  File "ThemeAutomator in /Users/coop/Library/Application Support/Sublime Text 3/Installed Packages/ThemeAutomator.sublime-package", line 51, in set_scheme_for_extension
  File "ThemeAutomator in /Users/coop/Library/Application Support/Sublime Text 3/Installed Packages/ThemeAutomator.sublime-package", line 41, in add_scheme
AttributeError: 'NoneType' object has no attribute 'append'

插件有什么问题?

您可以查看code of the plug-in here

0 个答案:

没有答案