molc
molc
provides a mock (fake) language client for testing language servers.
You can see specific examples of molc use in ELS.
```rust use lsp_types::{Url, Value};
use molc::{FakeClient, LangServer, RedirectableStdout}; use molc::oneline_range;
pub struct Server {
stdout_redirect: Option
impl LangServer for Server {
fn dispatch(&mut self, msg: impl Into
impl RedirectableStdout for Server {
fn sender(&self) -> Option<&std::sync::mpsc::Sender
impl Server {
fn bindfakeclient() -> FakeClient
fn init(&mut self, msg: &Value, id: i64) -> ELSResult<()> {
self.send_log("initializing the language server")?;
let result = InitializeResult {
...
};
self.init_services();
self.send_stdout(&json!({
"jsonrpc": "2.0",
"id": id,
"result": result,
}))
}
...
}
fn testreferences() -> Result<(), Box