move LSP serve method to main cli crate and fix shutdown handling (#143)

This commit is contained in:
Josh Thomas 2025-05-13 15:52:47 -05:00 committed by GitHub
parent d55ca65a70
commit 26cd151ef5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 178 additions and 49 deletions

View file

@ -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;

View file

@ -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");
}
}
}