mirror of
https://github.com/joshuadavidthomas/django-language-server.git
synced 2025-08-04 01:58:18 +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
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]
|
||||
name = "djls"
|
||||
name = "djls-server"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
|
@ -80,8 +80,7 @@ impl LanguageServer for TowerLspBackend {
|
|||
}
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
pub async fn serve() -> Result<()> {
|
||||
let django = DjangoProject::setup()?;
|
||||
|
||||
let stdin = tokio::io::stdin();
|
Loading…
Add table
Add a link
Reference in a new issue