extended message types; added traceback logging

This commit is contained in:
itdominator 2024-10-02 22:13:52 -05:00
parent 46d358aab7
commit 0789cec010
2 changed files with 17 additions and 4 deletions

View File

@ -14,7 +14,7 @@ from gi.repository import GLib
# Application imports # Application imports
from .lsp_message_structs import LSPResponseRequest from .lsp_message_structs import LSPResponseRequest
from .lsp_message_structs import LSPResponseNotification from .lsp_message_structs import LSPResponseNotification, LSPIDResponseNotification
from .lsp_message_structs import get_message_obj from .lsp_message_structs import get_message_obj
@ -70,7 +70,7 @@ class ClientIPC:
start_time = time.perf_counter() start_time = time.perf_counter()
self._handle_ipc_message(conn, start_time) self._handle_ipc_message(conn, start_time)
except Exception as e: except Exception as e:
logger.debug( repr(e) ) logger.debug( traceback.print_exc() )
listener.close() listener.close()
@ -96,7 +96,7 @@ class ClientIPC:
lsp_response = LSPResponseRequest(**get_message_obj(data_str)) lsp_response = LSPResponseRequest(**get_message_obj(data_str))
if "method" in keys: if "method" in keys:
lsp_response = LSPResponseNotification(**get_message_obj(data_str)) lsp_response = LSPResponseNotification( **get_message_obj(data_str) ) if not "id" in keys else LSPIDResponseNotification( **get_message_obj(data_str) )
if "notification" in keys: if "notification" in keys:
... ...

View File

@ -36,6 +36,19 @@ class LSPResponseNotification(object):
method: str method: str
params: dict params: dict
@dataclass
class LSPIDResponseNotification(object):
"""
Constructs a new LSP Response Notification instance.
class LSPResponseTypes(LSPResponseRequest, LSPResponseNotification): :param str method: The type of lsp notification being made.
:params dict result: The arguments of the given method.
"""
jsonrpc: str
id: int
method: str
params: dict
class LSPResponseTypes(LSPResponseRequest, LSPResponseNotification, LSPIDResponseNotification):
... ...