From baa07a7480f80a9dd441c85fa5e7607d01870f08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D1=80=D0=B5=D0=B4=D1=80=D0=B0=D0=B3=20=D0=9D=D0=B8?= =?UTF-8?q?=D0=BA=D0=BE=D0=BB=D0=B8=D1=9B?= Date: Mon, 24 Jun 2024 19:38:28 +0200 Subject: [PATCH] Add on_server_notification_async API (#2496) * add on_server_notification_async * make the API more similar to on_pre_send_notification_async First I tired to make it look like on_server_response_async but the method argument is redundant * outdated comment --- plugin/core/sessions.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugin/core/sessions.py b/plugin/core/sessions.py index 8d06245f9..ccb30b429 100644 --- a/plugin/core/sessions.py +++ b/plugin/core/sessions.py @@ -1047,6 +1047,14 @@ def on_server_response_async(self, method: str, response: Response) -> None: """ pass + def on_server_notification_async(self, notification: Notification) -> None: + """ + Notifies about a notification message that has been received from the language server. + + :param notification: The notification object. + """ + pass + def on_open_uri_async(self, uri: DocumentUri, callback: Callable[[str, str, str], None]) -> bool: """ Called when a language server reports to open an URI. If you know how to handle this URI, then return True and @@ -2377,6 +2385,8 @@ def deduce_payload( else: res = (handler, result, None, "notification", method) self._logger.incoming_notification(method, result, res[0] is None) + if self._plugin: + self._plugin.on_server_notification_async(Notification(method, result)) return res elif "id" in payload: if payload["id"] is None: