diff options
Diffstat (limited to 'crates/gen_lsp_server/src/lib.rs')
-rw-r--r-- | crates/gen_lsp_server/src/lib.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/crates/gen_lsp_server/src/lib.rs b/crates/gen_lsp_server/src/lib.rs index edbdda6c8..1cd5a3a7c 100644 --- a/crates/gen_lsp_server/src/lib.rs +++ b/crates/gen_lsp_server/src/lib.rs | |||
@@ -2,21 +2,16 @@ | |||
2 | //! This crate handles protocol handshaking and parsing messages, while you | 2 | //! This crate handles protocol handshaking and parsing messages, while you |
3 | //! control the message dispatch loop yourself. | 3 | //! control the message dispatch loop yourself. |
4 | //! | 4 | //! |
5 | //! Run with `RUST_LOG=sync_lsp_server=debug` to see all the messages. | 5 | //! Run with `RUST_LOG=gen_lsp_server=debug` to see all the messages. |
6 | //! | 6 | //! |
7 | //! ```no_run | 7 | //! ```no_run |
8 | //! extern crate gen_lsp_server; | ||
9 | //! extern crate lsp_types; | ||
10 | //! extern crate failure; | ||
11 | //! extern crate crossbeam_channel; | ||
12 | //! | ||
13 | //! use crossbeam_channel::{Sender, Receiver}; | 8 | //! use crossbeam_channel::{Sender, Receiver}; |
14 | //! use lsp_types::{ServerCapabilities, InitializeParams, request::{GotoDefinition, GotoDefinitionResponse}}; | 9 | //! use lsp_types::{ServerCapabilities, InitializeParams, request::{GotoDefinition, GotoDefinitionResponse}}; |
15 | //! use gen_lsp_server::{run_server, stdio_transport, handle_shutdown, RawMessage, RawResponse}; | 10 | //! use gen_lsp_server::{run_server, stdio_transport, handle_shutdown, RawMessage, RawResponse}; |
16 | //! | 11 | //! |
17 | //! fn main() -> Result<(), failure::Error> { | 12 | //! fn main() -> Result<(), failure::Error> { |
18 | //! let (receiver, sender, io_threads) = stdio_transport(); | 13 | //! let (receiver, sender, io_threads) = stdio_transport(); |
19 | //! gen_lsp_server::run_server( | 14 | //! run_server( |
20 | //! ServerCapabilities::default(), | 15 | //! ServerCapabilities::default(), |
21 | //! receiver, | 16 | //! receiver, |
22 | //! sender, | 17 | //! sender, |
@@ -38,13 +33,13 @@ | |||
38 | //! None => return Ok(()), | 33 | //! None => return Ok(()), |
39 | //! Some(req) => req, | 34 | //! Some(req) => req, |
40 | //! }; | 35 | //! }; |
41 | //! let req = match req.cast::<GotoDefinition>() { | 36 | //! match req.cast::<GotoDefinition>() { |
42 | //! Ok((id, _params)) => { | 37 | //! Ok((id, _params)) => { |
43 | //! let resp = RawResponse::ok::<GotoDefinition>( | 38 | //! let resp = RawResponse::ok::<GotoDefinition>( |
44 | //! id, | 39 | //! id, |
45 | //! &Some(GotoDefinitionResponse::Array(Vec::new())), | 40 | //! &Some(GotoDefinitionResponse::Array(Vec::new())), |
46 | //! ); | 41 | //! ); |
47 | //! sender.send(RawMessage::Response(resp)); | 42 | //! sender.send(RawMessage::Response(resp))?; |
48 | //! continue; | 43 | //! continue; |
49 | //! }, | 44 | //! }, |
50 | //! Err(req) => req, | 45 | //! Err(req) => req, |