-
-
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 2 commits
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.force_shutdown().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. If we're opting for this instead, this method already prints an error message on shutdown failure, so we don't need one here too. It should suffice to just call the method. 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. @dead10ck After looking at a lot of my code and searching for the problem, I overlooked that the branch from which I use the helix executable had another branch merged into it, specifically #2653, which I believe keeps the old_client active. By testing the clean master branch, I was able to verify that the old process is definitely removed. 😕😄 I will proceed to close both the issue and the pr, since they have no effect. |
||
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