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

Add command to restart LSP server #2105

Closed
wants to merge 1 commit into from

Conversation

threecgreen
Copy link

Implements #523.

Based on the discussion in #533, there's additional events I should be handling, but I wanted to make sure I was on the right track.

Useful if LSP configuration changes or crashes
Comment on lines +346 to +355
if let Some((_, client)) = self.inner.get(&language_config.scope) {
Ok(client.clone())
} else {
let id = self.counter.fetch_add(1, Ordering::Relaxed);
let client = self.initialize_client(language_config, config, id)?; // initialize a new client
self.inner
.insert(language_config.scope.clone(), (id, client.clone()));
Ok(client)
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change here? This was deliberate since we don't want to try reinitializing the client if we already tried starting it and failed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the functionality of get should be unchanged; I pulled out initialize_client into its own function so that I could also use it in restart. I switched from using self.inner.entry to self.inner.get to avoid multiple mutable borrows.

@the-mikedavis the-mikedavis added the S-waiting-on-review Status: Awaiting review from a maintainer. label May 18, 2022
@Niedzwiedzw
Copy link

this!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants