mirror of
https://github.com/joshuadavidthomas/django-language-server.git
synced 2025-09-27 12:29:30 +00:00
create djls-cli and migrate serving LSP to it (#20)
This commit is contained in:
parent
2cbc24b5f0
commit
4c10afb602
9 changed files with 46 additions and 4 deletions
|
@ -3,11 +3,12 @@ members = ["crates/*"]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
djls = { path = "crates/djls" }
|
|
||||||
djls-ast = { path = "crates/djls-ast" }
|
djls-ast = { path = "crates/djls-ast" }
|
||||||
|
djls-cli = { path = "crates/djls-cli" }
|
||||||
djls-django = { path = "crates/djls-django" }
|
djls-django = { path = "crates/djls-django" }
|
||||||
djls-ipc = { path = "crates/djls-ipc" }
|
djls-ipc = { path = "crates/djls-ipc" }
|
||||||
djls-python = { path = "crates/djls-python" }
|
djls-python = { path = "crates/djls-python" }
|
||||||
|
djls-server = { path = "crates/djls-server" }
|
||||||
djls-worker = { path = "crates/djls-worker" }
|
djls-worker = { path = "crates/djls-worker" }
|
||||||
|
|
||||||
anyhow = "1.0.94"
|
anyhow = "1.0.94"
|
||||||
|
|
18
crates/djlc-cli/Cargo.toml
Normal file
18
crates/djlc-cli/Cargo.toml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
[package]
|
||||||
|
name = "djls-cli"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
djls-django = { workspace = true }
|
||||||
|
djls-server = { workspace = true }
|
||||||
|
|
||||||
|
anyhow = { workspace = true }
|
||||||
|
tokio = { workspace = true }
|
||||||
|
|
||||||
|
clap = { version = "4.5.23", features = ["derive"] }
|
||||||
|
tower-lsp = { version = "0.20.0", features = ["proposed"] }
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "djls"
|
||||||
|
path = "src/main.rs"
|
24
crates/djlc-cli/src/main.rs
Normal file
24
crates/djlc-cli/src/main.rs
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
use clap::{Parser, Subcommand};
|
||||||
|
|
||||||
|
#[derive(Debug, Parser)]
|
||||||
|
struct Cli {
|
||||||
|
#[command(subcommand)]
|
||||||
|
command: Commands,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Subcommand)]
|
||||||
|
enum Commands {
|
||||||
|
/// Start the LSP server
|
||||||
|
Serve,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
let cli = Cli::parse();
|
||||||
|
|
||||||
|
match cli.command {
|
||||||
|
Commands::Serve => djls_server::serve().await?,
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "djls"
|
name = "djls-server"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
|
@ -80,8 +80,7 @@ impl LanguageServer for TowerLspBackend {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::main]
|
pub async fn serve() -> Result<()> {
|
||||||
async fn main() -> Result<()> {
|
|
||||||
let django = DjangoProject::setup()?;
|
let django = DjangoProject::setup()?;
|
||||||
|
|
||||||
let stdin = tokio::io::stdin();
|
let stdin = tokio::io::stdin();
|
Loading…
Add table
Add a link
Reference in a new issue