randy3k / AutomaticPackageReloader

Automatically reload submodules while developing a Sublime Text package.
MIT License
38 stars 13 forks source link

Drop dummy module installing #50

Closed deathaxe closed 10 months ago

deathaxe commented 11 months ago

Resolves #45

This PR drops installation/removal of a dummy package, which was meant to trigger ST reloading plugins.

That's obsolete as reload_package()...

  1. calls sublime_plugin.unload_module() to remove all plugin hooks (Commands & Listeners)
  2. reloads all plugins (and their imports)
  3. calls sublime_plugin.load_module(module) to re-instantiate all plugin hooks (Commands & Listeners)

That's all which is needed to reload package's plugins.

Note: This commit removes threading and sorts remaining imports.

deathaxe commented 11 months ago

This one probably requires some further verification as original intent of removed code is not yet completely clear. There's a chance of missing an important detail.

randy3k commented 10 months ago

There were some edge cases that only the python modules are reloaded, but the underlying call to the TextCommand's used in view.run_command are not updated. I am not sure if it is still the case.

deathaxe commented 10 months ago

After some more investigation it seems to still be an issue, unfortunatably. I was under the impression it not beeing needed anymore as ST reloads everything correctly, when saving a top-level plugin.

I already thought about opening an existing top-level module in background and just run "save" command for it to replace dummy module creation, in order to be more future prove - in case another pyhton plugin_host appears. But I haven't looked into it.

Temporarily disabling and enabling a package would also work, but may have other unwanted side effects such as reloading syntaxes, menues, ... .