feat(lsp): improve shutdown lifecycle and response handling

- Add explicit shutdown and exit requests to LSP client
- Rename initialized message to initialized notification
- Handle initialize → send initialized notification
- Handle shutdown → send exit notification

fix(lsp): delay client teardown to allow graceful shutdown
- Close LSP client and response handlers after timeout (GLib)

feat(vte): major terminal widget improvements
- Switch to spawn_async with full environment inheritance
- Improve PROMPT_COMMAND handling for cwd tracking (OSC7)
- Enable scrollback, disable audible bell, enable scroll-on-output
- Add clipboard shortcuts (Ctrl+Shift+C/V), middle-click paste
- Track current directory changes and update UI label
- Add proper signal wiring and cleanup on destroy

feat(ui): improve Plugins dialog behavior
- Make dialog non-modal and centered on parent window
- Auto-hide on focus loss and Ctrl+Shift+P shortcut
- Ensure proper destroy-with-parent behavior

refactor: add type hints and minor cleanup
- Add explicit typing for VteWidget fields
- Improve signal naming consistency
- Minor formatting and cleanup in folding and LSP modules
This commit is contained in:
2026-04-13 00:54:51 -05:00
parent a8ad015e05
commit 2d4c8e4f31
6 changed files with 138 additions and 24 deletions

View File

@@ -15,6 +15,8 @@ from ..dto.code.lsp.lsp_messages import definition_request
from ..dto.code.lsp.lsp_messages import implementation_request
from ..dto.code.lsp.lsp_messages import references_request
from ..dto.code.lsp.lsp_messages import symbols_request
from ..dto.code.lsp.lsp_messages import shutdown_request
from ..dto.code.lsp.lsp_messages import exit_request
@@ -36,9 +38,15 @@ class LSPClientEvents:
self._init_params["initializationOptions"] = self._init_opts
self.send_request("initialize", self._init_params)
def send_initialized_message(self):
def send_initialized_notification(self):
self.send_notification("initialized")
def send_shutdown_request(self):
self.send_request("shutdown")
def send_exit_notification(self):
self.send_notification("exit")
def _lsp_did_open(self, data: dict):
method = "textDocument/didOpen"
params = didopen_notification["params"]

View File

@@ -183,7 +183,6 @@ references_request = {
}
}
symbols_request = {
"method": "textDocument/documentSymbol",
"params": {
@@ -195,3 +194,14 @@ symbols_request = {
}
}
}
shutdown_request = {
"method": "shutdown",
"params": None
}
exit_request = {
"method": "exit",
"params": None
}

View File

@@ -1,6 +1,9 @@
# Python imports
# Lib imports
import gi
from gi.repository import GLib
# Application imports
from libs.controllers.controller_base import ControllerBase
@@ -109,8 +112,16 @@ class LSPManager(ControllerBase):
return True
def close_client(self, lang_id: str) -> bool:
self.client_manager.close_client(lang_id)
self.response_registry.close_handler(lang_id)
controller = self.client_manager.get_active_client()
controller.send_shutdown_request()
def _close():
self.client_manager.close_client(lang_id)
self.response_registry.close_handler(lang_id)
return False
GLib.timeout_add(5000, _close)
return True

View File

@@ -17,6 +17,10 @@ class DefaultHandler(BaseHandler):
def handle(self, method: str, response, controller):
match method:
case "initialize":
controller.send_initialized_notification()
case "shutdown":
controller.send_exit_notification()
case "textDocument/completion":
self._handle_completion(response)
case "textDocument/definition":