Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ serde_json = "1.0"
basic-toml = "0.1"
pkg-config = "0.3"
clap = { version = "4.5", features = ["derive"] }
const_format = "0.2"

[dev-dependencies]
insta = { version = "1.43", features = ["yaml", "redactions"] }
24 changes: 22 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use async_lsp::panic::CatchUnwindLayer;
use async_lsp::server::LifecycleLayer;
use async_lsp::tracing::TracingLayer;
use clap::Parser;
use const_format::concatcp;
use server::{ProtoLanguageServer, TickEvent};
use tower::ServiceBuilder;
use tracing::Level;
Expand All @@ -25,13 +26,32 @@ mod workspace;

/// Language server for proto3 files
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None, ignore_errors(true))]
#[command(
author,
version = concatcp!(
env!("CARGO_PKG_VERSION"),
"\n",
BUILD_INFO
),
about,
long_about = None,
ignore_errors(true)
)]
struct Cli {
/// Include paths for proto files
#[arg(short, long, value_delimiter = ',')]
include_paths: Option<Vec<String>>,
}

const FALLBACK_INCLUDE_PATH: Option<&str> = option_env!("FALLBACK_INCLUDE_PATH");
const BUILD_INFO: &str = concatcp!(
"fallback include path: ",
match FALLBACK_INCLUDE_PATH {
Some(path) => path,
None => "not set",
}
);

#[tokio::main(flavor = "current_thread")]
async fn main() {
let cli = Cli::parse();
Expand All @@ -48,7 +68,7 @@ async fn main() {
.with_writer(file_appender.0)
.init();

let fallback_include_path = option_env!("FALLBACK_INCLUDE_PATH").map(Into::into);
let fallback_include_path = FALLBACK_INCLUDE_PATH.map(Into::into);

tracing::info!("server version: {}", env!("CARGO_PKG_VERSION"));
let (server, _) = async_lsp::MainLoop::new_server(|client| {
Expand Down