From caf434992563cbdedeccb5574af16091e987f365 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Sat, 8 May 2021 18:17:13 +0900 Subject: Remove some of the panics, just log instead. --- helix-lsp/src/lib.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'helix-lsp') 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 { 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) } } -- cgit v1.2.3-70-g09d2