mirror of
https://github.com/joshuadavidthomas/django-language-server.git
synced 2025-08-04 01:58:18 +00:00
move LSP serve method to main cli crate and fix shutdown handling (#143)
This commit is contained in:
parent
d55ca65a70
commit
26cd151ef5
8 changed files with 178 additions and 49 deletions
|
@ -3,17 +3,4 @@ mod queue;
|
|||
mod server;
|
||||
mod workspace;
|
||||
|
||||
use crate::server::DjangoLanguageServer;
|
||||
use anyhow::Result;
|
||||
use tower_lsp_server::{LspService, Server};
|
||||
|
||||
pub async fn serve() -> Result<()> {
|
||||
let stdin = tokio::io::stdin();
|
||||
let stdout = tokio::io::stdout();
|
||||
|
||||
let (service, socket) = LspService::build(DjangoLanguageServer::new).finish();
|
||||
|
||||
Server::new(stdin, stdout, socket).serve(service).await;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
pub use crate::server::DjangoLanguageServer;
|
||||
|
|
|
@ -105,7 +105,7 @@ impl Queue {
|
|||
}
|
||||
}
|
||||
}
|
||||
eprintln!("Queue worker task shutting down.");
|
||||
eprintln!("Queue worker task shutting down");
|
||||
});
|
||||
|
||||
Self {
|
||||
|
@ -179,7 +179,7 @@ impl Drop for QueueInner {
|
|||
// `.ok()` ignores the result, as the receiver might have already
|
||||
// terminated if the channel closed naturally or panicked.
|
||||
sender.send(()).ok();
|
||||
eprintln!("Sent shutdown signal to queue worker.");
|
||||
eprintln!("Sent shutdown signal to queue worker");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue