Shutdown copilot server when quitting zed
This commit is contained in:
parent
7258db7a4e
commit
1533c17cd7
1 changed files with 15 additions and 0 deletions
|
@ -24,6 +24,7 @@ use std::{
|
||||||
mem,
|
mem,
|
||||||
ops::Range,
|
ops::Range,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
|
pin::Pin,
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
};
|
};
|
||||||
use util::{
|
use util::{
|
||||||
|
@ -271,6 +272,20 @@ pub struct Copilot {
|
||||||
|
|
||||||
impl Entity for Copilot {
|
impl Entity for Copilot {
|
||||||
type Event = ();
|
type Event = ();
|
||||||
|
|
||||||
|
fn app_will_quit(
|
||||||
|
&mut self,
|
||||||
|
_: &mut AppContext,
|
||||||
|
) -> Option<Pin<Box<dyn 'static + Future<Output = ()>>>> {
|
||||||
|
match mem::replace(&mut self.server, CopilotServer::Disabled) {
|
||||||
|
CopilotServer::Running(server) => Some(Box::pin(async move {
|
||||||
|
if let Some(shutdown) = server.lsp.shutdown() {
|
||||||
|
shutdown.await;
|
||||||
|
}
|
||||||
|
})),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copilot {
|
impl Copilot {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue