Skip to content

Add shutdown provider#4

Open
davidgranstrom wants to merge 2 commits intoscztt:developfrom
davidgranstrom:topic/shutdown-provider
Open

Add shutdown provider#4
davidgranstrom wants to merge 2 commits intoscztt:developfrom
davidgranstrom:topic/shutdown-provider

Conversation

@davidgranstrom
Copy link
Contributor

Hi!

This is an attempt to implement shutdown requests.

This is useful for the stdio adapter that communicates with the nvim LSP client so that we can shut down the node process on nvim exit and thus freeing the open ports.

I did not implement this part of the spec:

If a server receives requests after a shutdown request those requests should error with InvalidRequest.

We could perhaps set a flag in LSPConnection to signal when a shutdown request has been received, but I did not want to complicate the code until I get to know the code base a bit better.

@scztt
Copy link
Owner

scztt commented Apr 12, 2022

Apart from my comments, this looks good! Hopefully the LSPProvider API is clear to implement things, I'm open to feedback.

I agree, I think shutdown should probably be owned by LSPConnection, and the provider should just signal to it somehow. In the future maybe we add ShutdownProvider as a "default" provider in addition to InitializeProvider, and then listen for changes via addDependant. But this is fine for now, it's very clean as it is.

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.

2 participants