feat: improve LSP lifecycle, terminal widget, and code folding support
- LSP: - Add shutdown and exit request/notification handling - Send initialized notification after initialize response - Gracefully close clients with delayed shutdown via GLib timeout - Fix LSP WS server ↔ Godot LSP communication flow - Terminal (VteWidget): - Switch to async spawn with full environment inheritance - Add PROMPT_COMMAND OSC7 support for cwd tracking - Improve UX: scrollback, no audible bell, auto scroll - Implement clipboard shortcuts, selection copy, middle-click paste - Track cwd changes and update UI label - Add proper signal wiring and cleanup on destroy - Code folding: - Add fold support for JS, HTML, CSS, JSON, C, C++, Go - Reset fold state safely when AST or filetype is unavailable - UI (Plugins dialog): - Improve dialog behavior (non-modal, centered, transient) - Add focus-out auto-hide and Ctrl+Shift+P shortcut - Misc: - Add type hints in VTE widget - Update TODOs (remove completed items, add LSP comm fix) - Add terminal plugin scaffolding
This commit is contained in:
@@ -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"]
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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":
|
||||
|
||||
Reference in New Issue
Block a user