swap from IPC architecture to PyO3 library (#45)

This commit is contained in:
Josh Thomas 2024-12-23 10:12:10 -06:00 committed by GitHub
parent df30aafde5
commit a73e912e0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
53 changed files with 136 additions and 2224 deletions

View file

@ -6,8 +6,6 @@ mod tasks;
use crate::notifier::TowerLspNotifier;
use crate::server::{DjangoLanguageServer, LspNotification, LspRequest};
use anyhow::Result;
use djls_django::DjangoProject;
use djls_ipc::PythonProcess;
use std::sync::Arc;
use tokio::sync::RwLock;
use tower_lsp::jsonrpc::Result as LspResult;
@ -81,15 +79,13 @@ impl LanguageServer for TowerLspBackend {
}
}
pub async fn serve(python: PythonProcess) -> Result<()> {
let django = DjangoProject::setup(python)?;
pub async fn serve() -> Result<()> {
let stdin = tokio::io::stdin();
let stdout = tokio::io::stdout();
let (service, socket) = LspService::build(|client| {
let notifier = Box::new(TowerLspNotifier::new(client.clone()));
let server = DjangoLanguageServer::new(django, notifier);
let server = DjangoLanguageServer::new(notifier);
TowerLspBackend {
server: Arc::new(RwLock::new(server)),
}