diff options
author | Blaž Hrastnik | 2021-05-08 09:17:13 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-05-08 09:17:13 +0000 |
commit | caf434992563cbdedeccb5574af16091e987f365 (patch) | |
tree | f36feef8de909e4a698444fb10c672f2052972a3 /helix-lsp/src | |
parent | d24844b73db61e50e1d6fed898d3ff2ba8731356 (diff) |
Remove some of the panics, just log instead.
Diffstat (limited to 'helix-lsp/src')
-rw-r--r-- | helix-lsp/src/lib.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index 6adaa3f8..1bab2a17 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -130,10 +130,10 @@ pub enum Notification { } impl Notification { - pub fn parse(method: &str, params: jsonrpc::Params) -> Notification { + pub fn parse(method: &str, params: jsonrpc::Params) -> Option<Notification> { use lsp::notification::Notification as _; - match method { + let notification = match method { lsp::notification::PublishDiagnostics::METHOD => { let params: lsp::PublishDiagnosticsParams = params .parse() @@ -155,8 +155,13 @@ impl Notification { Notification::LogMessage(params) } - _ => unimplemented!("unhandled notification: {}", method), - } + _ => { + log::error!("unhandled LSP notification: {}", method); + return None; + } + }; + + Some(notification) } } |