Ignore invalid file URIs from LSP (#6000)
commit9368ac76b36f430cd127658d9e66b169053c9626
authorJonathan LEI <me@xjonathan.dev>
dateThu 16 Feb 2023, 13:17 (4 years ago)
parentc332b16
helix-term/src/application.rs+7−1
@@ -703,7 +703,13 @@ impl Application {
703703 }
704704 }
705705 Notification::PublishDiagnostics(mut params) => {
706− let path = params.uri.to_file_path().unwrap();
706+ let path = match params.uri.to_file_path() {
707+ Ok(path) => path,
708+ Err(_) => {
709+ log::error!("Unsupported file URI: {}", params.uri);
710+ return;
711+ }
712+ };
707713 let doc = self.editor.document_by_path_mut(&path);
708714
709715 if let Some(doc) = doc {