Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 31, 2026

VS Code LSP client was failing with No such method shutdown when stopping the server. The server lacked implementation of the required lifecycle RPCs.

Changes

  • Added shutdown request handler: Returns null response, sets shutdown_received flag
  • Added exit notification handler: Exits with code 0 after proper shutdown, code 1 otherwise per LSP spec
  • Added state tracking: shutdown_received: bool field in ProtoLanguageServer to determine exit behavior

Implementation

pub(super) fn shutdown(&mut self, _params: ()) -> BoxFuture<'static, Result<(), ResponseError>> {
    info!("Received shutdown request");
    self.shutdown_received = true;
    Box::pin(async move { Ok(()) })
}

pub(super) fn exit(&mut self, _params: ()) -> ControlFlow<async_lsp::Result<()>> {
    if self.shutdown_received {
        info!("Received exit notification after shutdown, exiting with code 0");
        std::process::exit(0);
    } else {
        warn!("Received exit notification without shutdown, exiting with code 1");
        std::process::exit(1);
    }
}

The LifecycleLayer middleware handles state transitions; these handlers provide the required lifecycle endpoints and exit code semantics.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • docs.rs
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)
  • microsoft.github.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Implement shutdown and exit RPCs for clean exit</issue_title>
<issue_description>For a clean exit, Shutdown and Exit notifications are sent by the client. Currently protols does not implement these two rpcs on the server side.

VS Code built-in LSP client is failing with the following error when a stop() command is given:

Error checking for protols updates: _ResponseError: No such method shutdown {code: -32601, data: null, stack: 'Error: No such method shutdown
	at handleResp…Trampoline (node:internal/async_hooks:130:17)', message: 'No such method shutdown'}

</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 31, 2026 10:29
- Added Shutdown request and Exit notification imports from async_lsp
- Implemented shutdown request handler that logs and returns empty response
- Implemented exit notification handler that logs the event
- Registered both handlers in the router
- Fixed code formatting in workspace_symbol.rs

Co-authored-by: coder3101 <22212259+coder3101@users.noreply.github.com>
As per LSP specification:
- Exit with code 0 if shutdown was received before exit
- Exit with code 1 if exit was received without shutdown

Added shutdown_received flag to track whether shutdown RPC was called,
and use it in exit handler to determine the appropriate exit code.

Co-authored-by: coder3101 <22212259+coder3101@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement shutdown and exit RPCs for clean exit Implement shutdown and exit RPCs per LSP specification Jan 31, 2026
Copilot AI requested a review from coder3101 January 31, 2026 10:38
@coder3101 coder3101 marked this pull request as ready for review January 31, 2026 10:38
@coder3101 coder3101 enabled auto-merge (squash) January 31, 2026 10:40
@coder3101 coder3101 disabled auto-merge January 31, 2026 10:41
@coder3101 coder3101 merged commit 38bab4b into main Jan 31, 2026
1 check passed
@coder3101 coder3101 deleted the copilot/implement-shutdown-exit-rpcs branch January 31, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement shutdown and exit RPCs for clean exit

2 participants