aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/main.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-11-08 15:43:02 +0000
committerAleksey Kladov <[email protected]>2018-11-08 15:43:02 +0000
commit00e80b24e3a46b3c4a6411151132fccc539abd5f (patch)
tree76fb0982fa8da3a915c7c226892681b30a044a86 /crates/ra_lsp_server/src/main.rs
parentc69ff08dc9074ed92c11e9fb6bf267288aa3fa25 (diff)
workspace-symbols function for Emacs
Diffstat (limited to 'crates/ra_lsp_server/src/main.rs')
-rw-r--r--crates/ra_lsp_server/src/main.rs22
1 files changed, 19 insertions, 3 deletions
diff --git a/crates/ra_lsp_server/src/main.rs b/crates/ra_lsp_server/src/main.rs
index 4d555d488..26bcddd8e 100644
--- a/crates/ra_lsp_server/src/main.rs
+++ b/crates/ra_lsp_server/src/main.rs
@@ -2,10 +2,14 @@
2extern crate log; 2extern crate log;
3#[macro_use] 3#[macro_use]
4extern crate failure; 4extern crate failure;
5#[macro_use]
6extern crate serde_derive;
7extern crate serde;
5extern crate flexi_logger; 8extern crate flexi_logger;
6extern crate gen_lsp_server; 9extern crate gen_lsp_server;
7extern crate ra_lsp_server; 10extern crate ra_lsp_server;
8 11
12use serde::Deserialize;
9use flexi_logger::{Duplicate, Logger}; 13use flexi_logger::{Duplicate, Logger};
10use gen_lsp_server::{run_server, stdio_transport}; 14use gen_lsp_server::{run_server, stdio_transport};
11use ra_lsp_server::Result; 15use ra_lsp_server::Result;
@@ -29,6 +33,13 @@ fn main() -> Result<()> {
29 } 33 }
30 } 34 }
31} 35}
36
37#[derive(Deserialize)]
38#[serde(rename_all = "camelCase")]
39struct InitializationOptions {
40 publish_decorations: bool,
41}
42
32fn main_inner() -> Result<()> { 43fn main_inner() -> Result<()> {
33 let (receiver, sender, threads) = stdio_transport(); 44 let (receiver, sender, threads) = stdio_transport();
34 let cwd = ::std::env::current_dir()?; 45 let cwd = ::std::env::current_dir()?;
@@ -41,7 +52,12 @@ fn main_inner() -> Result<()> {
41 .root_uri 52 .root_uri
42 .and_then(|it| it.to_file_path().ok()) 53 .and_then(|it| it.to_file_path().ok())
43 .unwrap_or(cwd); 54 .unwrap_or(cwd);
44 ra_lsp_server::main_loop(false, root, r, s) 55 let publish_decorations = params
56 .initialization_options
57 .and_then(|v| InitializationOptions::deserialize(v).ok())
58 .map(|it| it.publish_decorations)
59 == Some(true);
60 ra_lsp_server::main_loop(false, root, publish_decorations, r, s)
45 }, 61 },
46 )?; 62 )?;
47 info!("shutting down IO..."); 63 info!("shutting down IO...");
@@ -52,14 +68,14 @@ fn main_inner() -> Result<()> {
52 68
53/* 69/*
54 (let ((backend (eglot-xref-backend))) 70 (let ((backend (eglot-xref-backend)))
55 (mapcar 71 (mapcar
56 (lambda (xref) 72 (lambda (xref)
57 (let ((loc (xref-item-location xref))) 73 (let ((loc (xref-item-location xref)))
58 (propertize 74 (propertize
59 (concat 75 (concat
60 (when (xref-file-location-p loc) 76 (when (xref-file-location-p loc)
61 (with-slots (file line column) loc 77 (with-slots (file line column) loc
62 (format "%s:%s:%s:" 78 (format "%s:%s:%s:"
63 (propertize (file-relative-name file) 79 (propertize (file-relative-name file)
64 'face 'compilation-info) 80 'face 'compilation-info)
65 (propertize (format "%s" line) 81 (propertize (format "%s" line)