1 //! Implementation of the LSP for rust-analyzer.
3 //! This crate takes Rust-specific analysis results from ra_ide and translates
6 //! It also is the root of all state. `world` module defines the bulk of the
7 //! state, and `main_loop` module defines the rules for modifying it.
9 //! The `cli` submodule implements some batch-processing analysis, primarily as
11 #![recursion_limit = "512"]
16 macro_rules! println {
18 compile_error!("stdout is locked, use eprintln")
25 compile_error!("stdout is locked, use eprint")
31 mod cargo_target_spec;
41 use serde::de::DeserializeOwned;
43 pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;
45 caps::server_capabilities,
48 main_loop::{main_loop, show_message},
51 pub fn from_json<T: DeserializeOwned>(what: &'static str, json: serde_json::Value) -> Result<T> {
52 let res = T::deserialize(&json)
53 .map_err(|e| format!("Failed to deserialize {}: {}; {}", what, e, json))?;