-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lsp-restart]: call the force_shutdown method for the old_client #3972
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -356,7 +356,13 @@ impl Registry { | |
let NewClientResult(client, incoming) = start_client(id, language_config, config)?; | ||
self.incoming.push(UnboundedReceiverStream::new(incoming)); | ||
|
||
entry.insert((id, client.clone())); | ||
let (_, old_client) = entry.insert((id, client.clone())); | ||
|
||
tokio::spawn(async move { | ||
if let Err(e) = old_client.shutdown_and_exit().await { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we should also attempt to kill the child process ourselves as well in case this fails? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you could use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like that method does not attempt to do anything with the child process, so if the LS fails to kill itself after the Edit: Also, this can be in another PR. |
||
log::error!("failed shutdown language server: {}", e); | ||
} | ||
}); | ||
|
||
Ok(Some(client)) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we could add this to the Drop implementation instead on the server I guess?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a way of replicating this unfortunately, but what I'm thinking is that if you impl Drop for the client, then you could just call shutdown_and_exist, then print something if needed. This approach may also solve #3482
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When trying to implement the drop trait in the Client to call the shutdown method, I always have the problem of needing a lifetime of type 'static because self has an anonymous lifetime. 😫
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the main issue there it's shutdown is async, I'll take a look at thsi when I have some time. This is also not a blocker, was just an improvement for better encapsulation IMO