Skip to content

Commit

Permalink
lsp-devtools: Don't close server on client exit
Browse files Browse the repository at this point in the history
This allows commands like ``lsp-devtools record`` or ``lsp-devtools
inspect`` to capture multiple sessions without exiting
  • Loading branch information
alcarney committed Nov 12, 2023
1 parent 57a0ef5 commit fd80c9f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/lsp-devtools/changes/110.enhancement.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Commands like ``lsp-devtools record`` and ``lsp-devtools inspect`` will no longer exit/stop capturing messages after the first LSP session exits
7 changes: 5 additions & 2 deletions lib/lsp-devtools/lsp_devtools/agent/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ async def handle_client(reader, writer):
writer.close()
await writer.wait_closed()

if self._tcp_server is not None:
self._tcp_server.cancel()
# Uncomment if we ever need to introduce a mode where the server stops
# automatically once a session ends.
#
# if self._tcp_server is not None:
# self._tcp_server.cancel()

server = await asyncio.start_server(handle_client, host, port)
async with server:
Expand Down

0 comments on commit fd80c9f

Please sign in to comment.