workspace-symbols function for Emacs

This commit is contained in:
Aleksey Kladov 2018-11-08 18:43:02 +03:00
parent c69ff08dc9
commit 00e80b24e3
4 changed files with 43 additions and 12 deletions

View file

@ -2,10 +2,14 @@
extern crate log;
#[macro_use]
extern crate failure;
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate flexi_logger;
extern crate gen_lsp_server;
extern crate ra_lsp_server;
use serde::Deserialize;
use flexi_logger::{Duplicate, Logger};
use gen_lsp_server::{run_server, stdio_transport};
use ra_lsp_server::Result;
@ -29,6 +33,13 @@ fn main() -> Result<()> {
}
}
}
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
struct InitializationOptions {
publish_decorations: bool,
}
fn main_inner() -> Result<()> {
let (receiver, sender, threads) = stdio_transport();
let cwd = ::std::env::current_dir()?;
@ -41,7 +52,12 @@ fn main_inner() -> Result<()> {
.root_uri
.and_then(|it| it.to_file_path().ok())
.unwrap_or(cwd);
ra_lsp_server::main_loop(false, root, r, s)
let publish_decorations = params
.initialization_options
.and_then(|v| InitializationOptions::deserialize(v).ok())
.map(|it| it.publish_decorations)
== Some(true);
ra_lsp_server::main_loop(false, root, publish_decorations, r, s)
},
)?;
info!("shutting down IO...");
@ -52,14 +68,14 @@ fn main_inner() -> Result<()> {
/*
(let ((backend (eglot-xref-backend)))
(mapcar
(mapcar
(lambda (xref)
(let ((loc (xref-item-location xref)))
(propertize
(concat
(when (xref-file-location-p loc)
(with-slots (file line column) loc
(format "%s:%s:%s:"
(format "%s:%s:%s:"
(propertize (file-relative-name file)
'face 'compilation-info)
(propertize (format "%s" line)