Skip to content

Commit

Permalink
lsp-devtools: Apply ruff fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alcarney committed Nov 23, 2024
1 parent 9228616 commit d4bafff
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/lsp-devtools/lsp_devtools/agent/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self):
)
self.connected = False
self._buffer: list[bytes] = []
self._tasks: set[asyncio.Task[Any]] = set()

def _report_server_error(self, error, source):
# Bail on error
Expand Down Expand Up @@ -61,8 +62,12 @@ def forward_message(self, message: bytes):
while len(self._buffer) > 0:
res = self.protocol.writer.write(self._buffer.pop(0))
if inspect.isawaitable(res):
asyncio.ensure_future(res)
task = asyncio.ensure_future(res)
task.add_done_callback(self._tasks.discard)
self._tasks.add(task)

res = self.protocol.writer.write(message)
if inspect.isawaitable(res):
asyncio.ensure_future(res)
task = asyncio.ensure_future(res)
task.add_done_callback(self._tasks.discard)
self._tasks.add(task)

0 comments on commit d4bafff

Please sign in to comment.