add protobuf transport and refactor to support (#24)

This commit is contained in:
Josh Thomas 2024-12-11 20:28:57 -06:00 committed by GitHub
parent b3e0ee7b6e
commit 643a47953e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 406 additions and 74 deletions

View file

@ -9,6 +9,7 @@ djls-ipc = { workspace = true }
djls-server = { workspace = true }
anyhow = { workspace = true }
serde_json = { workspace = true }
tokio = { workspace = true }
clap = { version = "4.5.23", features = ["derive"] }

View file

@ -33,10 +33,6 @@ impl CommonOpts {
enum Commands {
/// Start the LSP server
Serve(CommonOpts),
/// Get Python environment information
Info(CommonOpts),
/// Print the version
Version(CommonOpts),
}
#[tokio::main]
@ -49,22 +45,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
PythonProcess::new("djls.lsp", Transport::Json, opts.health_check_interval())?;
djls_server::serve(python).await?
}
Commands::Info(opts) => {
let mut python =
PythonProcess::new("djls.lsp", Transport::Json, opts.health_check_interval())?;
match python.send("python_setup", None) {
Ok(info) => println!("{}", info),
Err(e) => eprintln!("Failed to get info: {}", e),
}
}
Commands::Version(opts) => {
let mut python =
PythonProcess::new("djls.lsp", Transport::Json, opts.health_check_interval())?;
match python.send("version", None) {
Ok(version) => println!("Python module version: {}", version),
Err(e) => eprintln!("Failed to get version: {}", e),
}
}
}
Ok(())