diff options
author | Aleksey Kladov <[email protected]> | 2018-11-08 15:43:02 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-11-08 15:43:02 +0000 |
commit | 00e80b24e3a46b3c4a6411151132fccc539abd5f (patch) | |
tree | 76fb0982fa8da3a915c7c226892681b30a044a86 /crates/ra_lsp_server/src/main.rs | |
parent | c69ff08dc9074ed92c11e9fb6bf267288aa3fa25 (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.rs | 22 |
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 @@ | |||
2 | extern crate log; | 2 | extern crate log; |
3 | #[macro_use] | 3 | #[macro_use] |
4 | extern crate failure; | 4 | extern crate failure; |
5 | #[macro_use] | ||
6 | extern crate serde_derive; | ||
7 | extern crate serde; | ||
5 | extern crate flexi_logger; | 8 | extern crate flexi_logger; |
6 | extern crate gen_lsp_server; | 9 | extern crate gen_lsp_server; |
7 | extern crate ra_lsp_server; | 10 | extern crate ra_lsp_server; |
8 | 11 | ||
12 | use serde::Deserialize; | ||
9 | use flexi_logger::{Duplicate, Logger}; | 13 | use flexi_logger::{Duplicate, Logger}; |
10 | use gen_lsp_server::{run_server, stdio_transport}; | 14 | use gen_lsp_server::{run_server, stdio_transport}; |
11 | use ra_lsp_server::Result; | 15 | use 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")] | ||
39 | struct InitializationOptions { | ||
40 | publish_decorations: bool, | ||
41 | } | ||
42 | |||
32 | fn main_inner() -> Result<()> { | 43 | fn 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) |