This repository has been archived by the owner on Aug 5, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
27: Potential improvements to error reporting r=bjorn3 a=AndrewRadev I've started experimenting with LSP (I'm new to using and interacting with language servers) and ran into some difficulties understanding the errors. I tried launching the example with `cargo run --example goto_def` and just copy-pasted some jsonrpc messages and it didn't work out. Here's how an interaction like this might look on master: ``` sh-session % cargo run --example goto_def starting generic LSP server foo Error: ProtocolError("expected initialize request, got Err(RecvError)") ``` After doing some digging I can see that the `RecvError` should have some more information, but the way that it's being printed doesn't show me a lot of it. Here's how the same interaction is rendered in this branch: ``` sh-session % cargo run --example goto_def starting generic LSP server foo Error: ProtocolError("expected initialize request, got error: receiving on an empty and disconnected channel") ``` So now I can at least guess that the problem doesn't have to do with parsing, but with the way the input is sent, and it would have to be the first thing to fix (like piping the commands by using a file). I think this is an improvement, but there might be different ways to make it better -- let me know. I'd also consider using `unreachable!` in cases where a `Message::Request` is expected, but a `Message::Response` is given, for example. Co-authored-by: Andrew Radev <[email protected]>
- Loading branch information