Skip to content

Commit 215f79d

Browse files
committed
use async jsonrpc api
1 parent 4c05ac4 commit 215f79d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pylsp/python_lsp.py

Lines changed: 9 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,14 @@ 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.gather(
124+
self._jsonrpc_stream_reader.listen_async(self._endpoint.consume_async),
125+
self._endpoint.consume_task()
126+
)
119127

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

0 commit comments

Comments
 (0)