+1
Bug: If the name of a class in a plugin file is changed, the plugin is not reloaded by Sublime until restarted
I encountered this problem while writing my first plugin. I was using the Sublime API incorrectly, then renamed my plugin class, then fixed the error. I was then terribly confused because the Python console continued to complain about the old plugin and its error. The problem went away when I restarted Sublime. (The renamed plugin was loaded, and the non-existent ExampleCommand was no longer loaded.)
Repro follows:
- Launch Sublime Text 2
- Open the Python console (Ctrl+`)
- Click "Tools > New Plugin..."
- Save the new plugin as "Packages/User/example.py"
- Change the plugin to subclass "sublime_plugin.EventListener"
- Rename the "run" method to "on_pre_save"
- (The plugin now contains an API usage error, because it references "self.view", which does not exist in EventListener.)
- Save and observe that the error is reported in the Python console: "AttributeError: 'ExampleCommand' object has no attribute 'view'"
- Change the name of your plugin class to "MyNewPlugin"
- Remove the "self.view" reference in the plugin class and replace it with a line "print 'I am trying to fix my plugin!'"
- Save and observe that the Python console still complains about the error in ExampleCommand, which no longer exists. The new plugin, MyNewPlugin, won't run at all
- Make sure example.py (containing the MyNewPlugin plugin) is saved
- Close and restart Sublime Text 2
- The Python console will no longer report ExampleCommand issues, since it does not exist. Any MyNewPlugin behavior or errors now will show up.
Please let me know if you need any more information.
Kundesupport af UserEcho