Skip to content

Commit

Permalink
Add on_server_notification_async API (#2496)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
predragnikolic authored Jun 24, 2024
1 parent f512c96 commit baa07a7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions plugin/core/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit baa07a7

Please sign in to comment.