2026-03-08 00:46:21 -06:00
|
|
|
# Python imports
|
|
|
|
|
|
|
|
|
|
# Lib imports
|
2026-03-11 23:15:19 -05:00
|
|
|
import gi
|
|
|
|
|
|
|
|
|
|
from gi.repository import GLib
|
2026-03-08 00:46:21 -06:00
|
|
|
|
|
|
|
|
# Application imports
|
|
|
|
|
from libs.event_factory import Event_Factory, Code_Event_Types
|
|
|
|
|
from libs.dto.states import SourceViewStates
|
|
|
|
|
|
|
|
|
|
from plugins.plugin_types import PluginCode
|
|
|
|
|
|
2026-03-15 20:45:58 -05:00
|
|
|
from .dto.code import events as lsp_events
|
2026-04-11 15:36:59 -05:00
|
|
|
from .commands import Commands
|
2026-03-12 00:04:08 -05:00
|
|
|
from .lsp_manager import LSPManager
|
2026-03-08 00:46:21 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-03-12 00:04:08 -05:00
|
|
|
lsp_manager = LSPManager()
|
2026-03-08 00:46:21 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Plugin(PluginCode):
|
|
|
|
|
def __init__(self):
|
|
|
|
|
super(Plugin, self).__init__()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _controller_message(self, event: Code_Event_Types.CodeEvent):
|
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
def load(self):
|
2026-03-15 20:45:58 -05:00
|
|
|
Event_Factory.register_events( lsp_events.__dict__.items() )
|
|
|
|
|
|
|
|
|
|
self.register_controller("lsp_manager", lsp_manager)
|
|
|
|
|
|
2026-03-08 00:46:21 -06:00
|
|
|
window = self.request_ui_element("main-window")
|
|
|
|
|
|
2026-04-11 15:36:59 -05:00
|
|
|
lsp_manager.ui_manager.map_parent_resize_event(window)
|
2026-03-08 00:46:21 -06:00
|
|
|
|
2026-04-11 15:36:59 -05:00
|
|
|
self._manage_signals("register_command")
|
2026-03-08 00:46:21 -06:00
|
|
|
|
2026-04-11 15:36:59 -05:00
|
|
|
self._manage_provider("register_provider")
|
2026-03-08 00:46:21 -06:00
|
|
|
|
|
|
|
|
event = Event_Factory.create_event(
|
|
|
|
|
"create_source_view",
|
|
|
|
|
state = SourceViewStates.INDEPENDENT
|
|
|
|
|
)
|
|
|
|
|
self.emit_to("source_views", event)
|
|
|
|
|
|
2026-04-11 15:36:59 -05:00
|
|
|
scrolled_win, source_view = event.response
|
|
|
|
|
lsp_manager.ui_manager.set_source_view(scrolled_win, source_view)
|
2026-03-11 23:15:19 -05:00
|
|
|
|
feat: Complete plugin lifecycle management with lazy loading and runtime reload
Major changes:
- Add unload() method to all plugins for proper cleanup (unregister commands/providers/LSP clients, destroy widgets, clear state)
- Implement lazy widget loading via "show" signal across all containers
- Add autoload: false manifest option for manual/conditional plugin loading
- Add Plugins UI with runtime load/unload toggle via Ctrl+Shift+p
- Implement controller unregistration system with proper signal disconnection
- Add new events: UnregisterCommandEvent, GetFilesEvent, GetSourceViewsEvent, TogglePluginsUiEvent
- Fix signal leaks by tracking and disconnecting handlers in widgets (search/replace, LSP manager, tabs, telescope, markdown preview)
- Add Save/Save As to tabs context menu
- Improve search/replace behavior (selection handling, focus management)
- Add telescope file initialization from existing loaded files
- Refactor plugin reload watcher to dynamically add/remove plugins on filesystem changes
- Add new plugins: file_history, extend_source_view_menu, godot_lsp_client
- Fix bug in prettify_json (undefined variable reference
2026-03-21 13:26:12 -05:00
|
|
|
def unload(self):
|
|
|
|
|
Event_Factory.unregister_events( lsp_events.__dict__.items() )
|
|
|
|
|
|
|
|
|
|
self.unregister_controller("lsp_manager")
|
|
|
|
|
|
|
|
|
|
window = self.request_ui_element("main-window")
|
|
|
|
|
|
2026-04-11 15:36:59 -05:00
|
|
|
lsp_manager.ui_manager.unmap_parent_resize_event(window)
|
|
|
|
|
|
|
|
|
|
self._manage_signals("unregister_command")
|
feat: Complete plugin lifecycle management with lazy loading and runtime reload
Major changes:
- Add unload() method to all plugins for proper cleanup (unregister commands/providers/LSP clients, destroy widgets, clear state)
- Implement lazy widget loading via "show" signal across all containers
- Add autoload: false manifest option for manual/conditional plugin loading
- Add Plugins UI with runtime load/unload toggle via Ctrl+Shift+p
- Implement controller unregistration system with proper signal disconnection
- Add new events: UnregisterCommandEvent, GetFilesEvent, GetSourceViewsEvent, TogglePluginsUiEvent
- Fix signal leaks by tracking and disconnecting handlers in widgets (search/replace, LSP manager, tabs, telescope, markdown preview)
- Add Save/Save As to tabs context menu
- Improve search/replace behavior (selection handling, focus management)
- Add telescope file initialization from existing loaded files
- Refactor plugin reload watcher to dynamically add/remove plugins on filesystem changes
- Add new plugins: file_history, extend_source_view_menu, godot_lsp_client
- Fix bug in prettify_json (undefined variable reference
2026-03-21 13:26:12 -05:00
|
|
|
|
2026-04-11 15:36:59 -05:00
|
|
|
self._manage_provider("unregister_provider")
|
|
|
|
|
|
|
|
|
|
lsp_manager.handle_destroy()
|
|
|
|
|
|
|
|
|
|
def _manage_signals(self, action: str):
|
|
|
|
|
_commands = Commands
|
|
|
|
|
_commands.lsp_manager = lsp_manager
|
|
|
|
|
|
|
|
|
|
event = Event_Factory.create_event(action,
|
|
|
|
|
command_name = "lsp_manager_toggle",
|
|
|
|
|
command = _commands.lsp_manager_toggle,
|
feat: Complete plugin lifecycle management with lazy loading and runtime reload
Major changes:
- Add unload() method to all plugins for proper cleanup (unregister commands/providers/LSP clients, destroy widgets, clear state)
- Implement lazy widget loading via "show" signal across all containers
- Add autoload: false manifest option for manual/conditional plugin loading
- Add Plugins UI with runtime load/unload toggle via Ctrl+Shift+p
- Implement controller unregistration system with proper signal disconnection
- Add new events: UnregisterCommandEvent, GetFilesEvent, GetSourceViewsEvent, TogglePluginsUiEvent
- Fix signal leaks by tracking and disconnecting handlers in widgets (search/replace, LSP manager, tabs, telescope, markdown preview)
- Add Save/Save As to tabs context menu
- Improve search/replace behavior (selection handling, focus management)
- Add telescope file initialization from existing loaded files
- Refactor plugin reload watcher to dynamically add/remove plugins on filesystem changes
- Add new plugins: file_history, extend_source_view_menu, godot_lsp_client
- Fix bug in prettify_json (undefined variable reference
2026-03-21 13:26:12 -05:00
|
|
|
binding_mode = "released",
|
2026-04-11 15:36:59 -05:00
|
|
|
binding = "<Shift><Control>l"
|
feat: Complete plugin lifecycle management with lazy loading and runtime reload
Major changes:
- Add unload() method to all plugins for proper cleanup (unregister commands/providers/LSP clients, destroy widgets, clear state)
- Implement lazy widget loading via "show" signal across all containers
- Add autoload: false manifest option for manual/conditional plugin loading
- Add Plugins UI with runtime load/unload toggle via Ctrl+Shift+p
- Implement controller unregistration system with proper signal disconnection
- Add new events: UnregisterCommandEvent, GetFilesEvent, GetSourceViewsEvent, TogglePluginsUiEvent
- Fix signal leaks by tracking and disconnecting handlers in widgets (search/replace, LSP manager, tabs, telescope, markdown preview)
- Add Save/Save As to tabs context menu
- Improve search/replace behavior (selection handling, focus management)
- Add telescope file initialization from existing loaded files
- Refactor plugin reload watcher to dynamically add/remove plugins on filesystem changes
- Add new plugins: file_history, extend_source_view_menu, godot_lsp_client
- Fix bug in prettify_json (undefined variable reference
2026-03-21 13:26:12 -05:00
|
|
|
)
|
|
|
|
|
self.emit_to("source_views", event)
|
|
|
|
|
|
2026-04-11 15:36:59 -05:00
|
|
|
event = Event_Factory.create_event(action,
|
|
|
|
|
command_name = "lsp_references",
|
|
|
|
|
command = _commands.lsp_references,
|
|
|
|
|
binding_mode = "released",
|
|
|
|
|
binding = "<Control>i"
|
feat: Complete plugin lifecycle management with lazy loading and runtime reload
Major changes:
- Add unload() method to all plugins for proper cleanup (unregister commands/providers/LSP clients, destroy widgets, clear state)
- Implement lazy widget loading via "show" signal across all containers
- Add autoload: false manifest option for manual/conditional plugin loading
- Add Plugins UI with runtime load/unload toggle via Ctrl+Shift+p
- Implement controller unregistration system with proper signal disconnection
- Add new events: UnregisterCommandEvent, GetFilesEvent, GetSourceViewsEvent, TogglePluginsUiEvent
- Fix signal leaks by tracking and disconnecting handlers in widgets (search/replace, LSP manager, tabs, telescope, markdown preview)
- Add Save/Save As to tabs context menu
- Improve search/replace behavior (selection handling, focus management)
- Add telescope file initialization from existing loaded files
- Refactor plugin reload watcher to dynamically add/remove plugins on filesystem changes
- Add new plugins: file_history, extend_source_view_menu, godot_lsp_client
- Fix bug in prettify_json (undefined variable reference
2026-03-21 13:26:12 -05:00
|
|
|
)
|
2026-04-11 15:36:59 -05:00
|
|
|
self.emit_to("source_views", event)
|
feat: Complete plugin lifecycle management with lazy loading and runtime reload
Major changes:
- Add unload() method to all plugins for proper cleanup (unregister commands/providers/LSP clients, destroy widgets, clear state)
- Implement lazy widget loading via "show" signal across all containers
- Add autoload: false manifest option for manual/conditional plugin loading
- Add Plugins UI with runtime load/unload toggle via Ctrl+Shift+p
- Implement controller unregistration system with proper signal disconnection
- Add new events: UnregisterCommandEvent, GetFilesEvent, GetSourceViewsEvent, TogglePluginsUiEvent
- Fix signal leaks by tracking and disconnecting handlers in widgets (search/replace, LSP manager, tabs, telescope, markdown preview)
- Add Save/Save As to tabs context menu
- Improve search/replace behavior (selection handling, focus management)
- Add telescope file initialization from existing loaded files
- Refactor plugin reload watcher to dynamically add/remove plugins on filesystem changes
- Add new plugins: file_history, extend_source_view_menu, godot_lsp_client
- Fix bug in prettify_json (undefined variable reference
2026-03-21 13:26:12 -05:00
|
|
|
|
2026-04-11 15:36:59 -05:00
|
|
|
event = Event_Factory.create_event(action,
|
|
|
|
|
command_name = "lsp_implementation",
|
|
|
|
|
command = _commands.lsp_implementation,
|
|
|
|
|
binding_mode = "released",
|
|
|
|
|
binding = "<Shift><Control>i"
|
|
|
|
|
)
|
|
|
|
|
self.emit_to("source_views", event)
|
|
|
|
|
|
|
|
|
|
event = Event_Factory.create_event(action,
|
|
|
|
|
command_name = "lsp_definition",
|
|
|
|
|
command = _commands.lsp_definition,
|
|
|
|
|
binding_mode = "released",
|
|
|
|
|
binding = "<Control>g"
|
|
|
|
|
)
|
|
|
|
|
self.emit_to("source_views", event)
|
|
|
|
|
|
|
|
|
|
def _manage_provider(self, action: str):
|
|
|
|
|
event = Event_Factory.create_event(
|
|
|
|
|
action,
|
|
|
|
|
provider_name = "LSP Completer",
|
|
|
|
|
provider = lsp_manager.provider,
|
|
|
|
|
language_ids = []
|
|
|
|
|
)
|
|
|
|
|
self.emit_to("completion", event)
|
feat: Complete plugin lifecycle management with lazy loading and runtime reload
Major changes:
- Add unload() method to all plugins for proper cleanup (unregister commands/providers/LSP clients, destroy widgets, clear state)
- Implement lazy widget loading via "show" signal across all containers
- Add autoload: false manifest option for manual/conditional plugin loading
- Add Plugins UI with runtime load/unload toggle via Ctrl+Shift+p
- Implement controller unregistration system with proper signal disconnection
- Add new events: UnregisterCommandEvent, GetFilesEvent, GetSourceViewsEvent, TogglePluginsUiEvent
- Fix signal leaks by tracking and disconnecting handlers in widgets (search/replace, LSP manager, tabs, telescope, markdown preview)
- Add Save/Save As to tabs context menu
- Improve search/replace behavior (selection handling, focus management)
- Add telescope file initialization from existing loaded files
- Refactor plugin reload watcher to dynamically add/remove plugins on filesystem changes
- Add new plugins: file_history, extend_source_view_menu, godot_lsp_client
- Fix bug in prettify_json (undefined variable reference
2026-03-21 13:26:12 -05:00
|
|
|
|
2026-03-08 00:46:21 -06:00
|
|
|
def run(self):
|
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
def generate_plugin_element(self):
|
|
|
|
|
...
|