Skip to content
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

Merged
merged 3 commits into from
Oct 3, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion helix-lsp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ impl Registry {
let (_, old_client) = entry.insert((id, client.clone()));

tokio::spawn(async move {
Copy link
Contributor

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?

Copy link
Contributor

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

Copy link
Contributor Author

@axdank axdank Sep 26, 2022

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. 😫

Copy link
Contributor

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

if let Err(e) = old_client.shutdown_and_exit().await {
if let Err(e) = old_client.force_shutdown().await {
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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);
}
});
Expand Down