aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_lsp_server/src/main.rs')
-rw-r--r--crates/ra_lsp_server/src/main.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/crates/ra_lsp_server/src/main.rs b/crates/ra_lsp_server/src/main.rs
index 8076a7fa5..cdd925c9f 100644
--- a/crates/ra_lsp_server/src/main.rs
+++ b/crates/ra_lsp_server/src/main.rs
@@ -6,7 +6,10 @@ use ra_prof;
6 6
7fn main() -> Result<()> { 7fn main() -> Result<()> {
8 setup_logging()?; 8 setup_logging()?;
9 run_server()?; 9 match Args::parse()? {
10 Args::Version => println!("rust-analyzer {}", env!("REV")),
11 Args::Run => run_server()?,
12 }
10 Ok(()) 13 Ok(())
11} 14}
12 15
@@ -22,6 +25,19 @@ fn setup_logging() -> Result<()> {
22 Ok(()) 25 Ok(())
23} 26}
24 27
28enum Args {
29 Version,
30 Run,
31}
32
33impl Args {
34 fn parse() -> Result<Args> {
35 let res =
36 if std::env::args().any(|it| it == "--version") { Args::Version } else { Args::Run };
37 Ok(res)
38 }
39}
40
25fn run_server() -> Result<()> { 41fn run_server() -> Result<()> {
26 log::info!("lifecycle: server started"); 42 log::info!("lifecycle: server started");
27 43