Unnamed repository; edit this file 'description' to name the repository.
Fix crash on lsp text edits with invalid ranges (#9649)
Eduardo Farinati 2024-04-06
parent 1ba5763 · commit d3bfa3e
-rw-r--r--helix-lsp/src/lib.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs
index c58d967b..f1ffcdf8 100644
--- a/helix-lsp/src/lib.rs
+++ b/helix-lsp/src/lib.rs
@@ -539,6 +539,16 @@ pub mod util {
} else {
return (0, 0, None);
};
+
+ if start > end {
+ log::error!(
+ "Invalid LSP text edit start {:?} > end {:?}, discarding",
+ start,
+ end
+ );
+ return (0, 0, None);
+ }
+
(start, end, replacement)
}),
)