laburnum 1.17.0

An LSP framework for building language servers and compilers, powered by an incremental query tree with content-addressed storage, task-based dataflow, and parallel queries.
Documentation
// Copyright Two Neutron Stars Incorporated and contributors
// SPDX-License-Identifier: BlueOak-1.0.0

//! Language Server Protocol (LSP) and Language Server Index Format (LSIF)
//! types.
//!
//! Based on <https://microsoft.github.io/language-server-protocol/specification>

mod macros;

pub mod error_codes;
pub mod ipc;
pub mod jsonrpc;
pub mod lsif;
pub mod lsp;
#[cfg(feature = "mcp")]
pub mod mcp;
pub mod otel;
pub(crate) mod task;

pub mod prelude {
  pub use crate::{
    Uri,
    protocol::{
      lsif::*,
      lsp::*,
    },
  };
}

#[cfg(test)]
mod tests {
  use serde::{
    Deserialize,
    Serialize,
  };

  pub fn test_serialization<SER>(ms: &SER, expected: &str)
  where
    SER: Serialize + for<'de> Deserialize<'de> + PartialEq + std::fmt::Debug,
  {
    let json_str = serde_json::to_string(ms).unwrap();
    assert_eq!(&json_str, expected);
    let deserialized: SER = serde_json::from_str(&json_str).unwrap();
    assert_eq!(&deserialized, ms);
  }

  pub fn test_deserialization<T>(json: &str, expected: &T)
  where
    T: for<'de> Deserialize<'de> + PartialEq + std::fmt::Debug,
  {
    let value = serde_json::from_str::<T>(json).unwrap();
    assert_eq!(&value, expected);
  }
}