aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2022-05-11 02:00:55 +0000
committerBlaž Hrastnik2022-05-11 02:00:55 +0000
commit7ae6cad52ed001a903577e30fb71e346fd831af7 (patch)
treed56cc0d097bbc9782e6d222ef65bd316bc68c0c8 /helix-term/src
parent8b1a03a1783d8eb176d178f11cfa229a9e9b8e59 (diff)
Don't panic on LSP parsing errors
This made sense initially when the implementation was still new (so we got user reports more frequently), but a parsing error now generally signifies a language server isn't properly implementing the spec.
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/application.rs24
1 files changed, 19 insertions, 5 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index 91caade7..2dfccf04 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -399,8 +399,14 @@ impl Application {
match call {
Call::Notification(helix_lsp::jsonrpc::Notification { method, params, .. }) => {
let notification = match Notification::parse(&method, params) {
- Some(notification) => notification,
- None => return,
+ Ok(notification) => notification,
+ Err(err) => {
+ log::error!(
+ "received malformed notification from Language Server: {}",
+ err
+ );
+ return;
+ }
};
match notification {
@@ -613,9 +619,17 @@ impl Application {
method, params, id, ..
}) => {
let call = match MethodCall::parse(&method, params) {
- Some(call) => call,
- None => {
- error!("Method not found {}", method);
+ Ok(call) => call,
+ Err(helix_lsp::Error::Unhandled) => {
+ error!("Language Server: Method not found {}", method);
+ return;
+ }
+ Err(err) => {
+ log::error!(
+ "received malformed method call from Language Server: {}: {}",
+ method,
+ err
+ );
return;
}
};