Compare commits

2 Commits

Author SHA1 Message Date
cb73f6b3b0 Fix unload lifecycle, widget cleanup, and plugin removal handling
- Rename GodotHandler to GDScriptHandler in LSP client
- Fix unload() method naming in nanoesq_temp_buffer plugin
- Return manifest_meta in manifest_manager for manual launch plugins
- Properly destroy tabs_widget, viewport, and scrolled_win on unload
- Refactor plugin removal to search all manifest lists and fix cleanup order
- Fix widget reference in plugins_ui (use child instead of box)
2026-03-23 23:05:20 -05:00
e6eaa1d83c Fixed file_history plugin after breakage from testing a pattern 2026-03-23 21:42:05 -05:00
10 changed files with 36 additions and 17 deletions

View File

@@ -1,8 +1,8 @@
___ ___
### Add ### Add
1. Add Godot LSP Client
1. Add TreeSitter 1. Add TreeSitter
1. Add Collapsable code blocks 1. Add Collapsable code blocks
1. Add Godot LSP Client
1. Add Terminal plugin 1. Add Terminal plugin
1. Add Plugin to <Shift\><Ctrl\>| and <Ctrl\>| to split views up, down, left, right 1. Add Plugin to <Shift\><Ctrl\>| and <Ctrl\>| to split views up, down, left, right
1. Add <Ctrl\>i to **lsp_manager** to list who implements xyz 1. Add <Ctrl\>i to **lsp_manager** to list who implements xyz

View File

@@ -25,7 +25,7 @@ class Plugin(PluginCode):
if len(history) == history_size: if len(history) == history_size:
history.pop(0) history.pop(0)
history.append(event.file) history.append(event.file.fpath)
def load(self): def load(self):
self._manage_signals("register_command") self._manage_signals("register_command")
@@ -60,6 +60,6 @@ class Handler:
view._on_uri_data_received( view._on_uri_data_received(
[ [
history.pop().replace("file://", "") f"file://{history.pop()}"
] ]
) )

View File

@@ -23,7 +23,7 @@ class Plugin(PluginCode):
def load(self): def load(self):
self._manage_signals("register_command") self._manage_signals("register_command")
def load(self): def unload(self):
self._manage_signals("unregister_command") self._manage_signals("unregister_command")
def _manage_signals(self, action: str): def _manage_signals(self, action: str):

View File

@@ -11,7 +11,7 @@ from libs.event_factory import Event_Factory, Code_Event_Types
from plugins.plugin_types import PluginCode from plugins.plugin_types import PluginCode
from .response_handler import GodotHandler from .response_handler import GDScriptHandler
@@ -30,7 +30,7 @@ class Plugin(PluginCode):
event = Event_Factory.create_event("register_lsp_client", event = Event_Factory.create_event("register_lsp_client",
lang_id = "gdscript", lang_id = "gdscript",
lang_config = config, lang_config = config,
handler = GodotHandler handler = GDScriptHandler
) )
self.emit_to("lsp_manager", event) self.emit_to("lsp_manager", event)

View File

@@ -1 +1 @@
from .python import PythonHandler from .gdscript import GDScriptHandler

View File

@@ -7,6 +7,6 @@ from lsp_manager.response_handlers.default import DefaultHandler
class GodotHandler(DefaultHandler): class GDScriptHandler(DefaultHandler):
"""Uses default handling, can override if Godot needs special logic.""" """Uses default handling, can override if Godot needs special logic."""
... ...

View File

@@ -50,7 +50,14 @@ class Plugin(PluginCode):
def unload(self): def unload(self):
self.unregister_controller("tabs") self.unregister_controller("tabs")
self.tabs_controller.unload_tabs() self.tabs_controller.unload_tabs()
self.tabs_controller.tabs_widget.destroy()
tabs_widget = self.tabs_controller.tabs_widget
viewport = tabs_widget.get_parent()
scrolled_win = viewport.get_parent()
tabs_widget.destroy()
viewport.destroy()
scrolled_win.destroy()
self.tabs_controller.tabs_widget = None self.tabs_controller.tabs_widget = None
self.tabs_controller = None self.tabs_controller = None

View File

@@ -56,7 +56,7 @@ class ManifestManager:
if not manifest.autoload: if not manifest.autoload:
self.manual_launch_manifests.append(manifest_meta) self.manual_launch_manifests.append(manifest_meta)
return return manifest_meta
if manifest.pre_launch: if manifest.pre_launch:
self.pre_launch_manifests.append(manifest_meta) self.pre_launch_manifests.append(manifest_meta)

View File

@@ -48,13 +48,13 @@ class PluginReloadMixin:
def remove_plugin(self, file: str) -> None: def remove_plugin(self, file: str) -> None:
logger.info(f"Removing plugin: {file.get_uri()}") logger.info(f"Removing plugin: {file.get_uri()}")
for manifest_meta in self._plugin_collection[:]:
if not manifest_meta.folder in file.get_uri(): continue
manifest_meta.instance.unload() manifests = self._manifest_manager.pre_launch_manifests \
manifest_meta.instance = None + self._manifest_manager.post_launch_manifests \
self._plugin_collection.remove(manifest_meta) + self._manifest_manager.manual_launch_manifests
self.plugins_ui.remove_row(manifest_meta)
for manifest_meta in manifests:
if not manifest_meta.folder in file.get_uri(): continue
if manifest_meta in self._manifest_manager.pre_launch_manifests: if manifest_meta in self._manifest_manager.pre_launch_manifests:
self._manifest_manager.pre_launch_manifests.remove(manifest_meta) self._manifest_manager.pre_launch_manifests.remove(manifest_meta)
@@ -63,4 +63,15 @@ class PluginReloadMixin:
elif manifest_meta in self._manifest_manager.manual_launch_manifests: elif manifest_meta in self._manifest_manager.manual_launch_manifests:
self._manifest_manager.manual_launch_manifests.remove(manifest_meta) self._manifest_manager.manual_launch_manifests.remove(manifest_meta)
self.plugins_ui.remove_row(manifest_meta)
break
del manifests
for manifest_meta in self._plugin_collection[:]:
if not manifest_meta.folder in file.get_uri(): continue
manifest_meta.instance.unload()
manifest_meta.instance = None
self._plugin_collection.remove(manifest_meta)
break break

View File

@@ -76,6 +76,7 @@ class PluginsUI(Gtk.Dialog):
toggle_bttn.toggle_id = \ toggle_bttn.toggle_id = \
toggle_bttn.connect("toggled", callback, manifest_meta) toggle_bttn.connect("toggled", callback, manifest_meta)
box.toggle_bttn = toggle_bttn
box.add(plugin_lbl) box.add(plugin_lbl)
box.add(author_lbl) box.add(author_lbl)
@@ -96,5 +97,5 @@ class PluginsUI(Gtk.Dialog):
toggle_bttn.disconnect(toggle_bttn.toggle_id) toggle_bttn.disconnect(toggle_bttn.toggle_id)
self.list_box.remove(row) self.list_box.remove(row)
box.destroy() child.destroy()
break break