Skip to content

Commit aa740f1

Browse files
committed
doc: add example
1 parent 3e4b051 commit aa740f1

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

examples/handle_message.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from __future__ import annotations
2+
3+
from typing import override
4+
5+
import anyio
6+
7+
import lsp_client
8+
from lsp_client import lsp_type
9+
from lsp_client.clients.pyrefly import PyreflyClient
10+
11+
lsp_client.enable_logging()
12+
13+
14+
class CustomClient(PyreflyClient):
15+
@override
16+
async def receive_log_message(self, noti: lsp_type.LogMessageNotification) -> None:
17+
print(f"✨ Log Message: {noti.params.message}")
18+
19+
20+
async def main():
21+
async with CustomClient() as client:
22+
print(client)
23+
24+
25+
if __name__ == "__main__":
26+
anyio.run(main)

0 commit comments

Comments
 (0)