Skip to content

Commit 9f0f03d

Browse files
committed
use async jsonrpc api
1 parent 4c05ac4 commit 9f0f03d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pylsp/python_lsp.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import os
77
import socketserver
88
import threading
9+
import asyncio
910

1011
from pylsp_jsonrpc.dispatchers import MethodDispatcher
1112
from pylsp_jsonrpc.endpoint import Endpoint
@@ -115,7 +116,11 @@ def __init__(self, rx, tx, check_parent_process=False):
115116

116117
def start(self):
117118
"""Entry point for the server."""
118-
self._jsonrpc_stream_reader.listen(self._endpoint.consume)
119+
asyncio.run(self.start_async())
120+
121+
async def start_async(self):
122+
self._endpoint.init_async()
123+
await asyncio.create_task(self._jsonrpc_stream_reader.listen_async(self._endpoint.consume_async))
119124

120125
def __getitem__(self, item):
121126
"""Override getitem to fallback through multiple dispatchers."""

0 commit comments

Comments
 (0)