The API states that if a plugin has a module level function called plugin_unloaded()
then it is run just before the plugin is unloaded.
However plugin_unloaded()
is only called if the plugin is unload manually, e.g. by deleting the plugin’s file while ST is still running, it DOES NOT get called when the exit
command is run and ST is closed.
The sister function plugin_loaded()
works perfectly when ST is started and I was expecting the same behaviour for plugin_unloaded()
- a callback which is run just before ST is closed. Isn’t that it’s intended purpose? Otherwise it is only called when removing or updating a plugin which, while being desirable, is not half as useful.
The function on_api_ready()
, in sublime_plugin.py
, controls calling each module’s plugin_loaded()
function - which works fine. But there is no equivalent to on_api_ready()
, defined in sublime_plugin.py
, for the exit application process.
I see this issue was raised in a SublimeTextIssues/Core
issue back in 2013; “on_application_close” addition.
Probably not but… Is there any way of running some code when ST exits so that a plugin’s state can be restored on startup?