From 8e041c99df8aff8e894263e738faecae41b4cf9b Mon Sep 17 00:00:00 2001
From: Pascal Kuthe <pascalkuthe@pm.me>
Date: Sun, 28 Jul 2024 23:22:28 +0200
Subject: [PATCH] stable sort lsp edits (#11357)

---
 helix-lsp/src/lib.rs           | 2 +-
 helix-term/src/commands/lsp.rs | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs
index 8e423e1c..81e4f620 100644
--- a/helix-lsp/src/lib.rs
+++ b/helix-lsp/src/lib.rs
@@ -503,7 +503,7 @@ pub mod util {
     ) -> Transaction {
         // Sort edits by start range, since some LSPs (Omnisharp) send them
         // in reverse order.
-        edits.sort_unstable_by_key(|edit| edit.range.start);
+        edits.sort_by_key(|edit| edit.range.start);
 
         // Generate a diff if the edit is a full document replacement.
         #[allow(clippy::collapsible_if)]
diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs
index 9194377c..4fffbb24 100644
--- a/helix-term/src/commands/lsp.rs
+++ b/helix-term/src/commands/lsp.rs
@@ -1360,7 +1360,7 @@ fn compute_inlay_hints_for_view(
 
             // Most language servers will already send them sorted but ensure this is the case to
             // avoid errors on our end.
-            hints.sort_unstable_by_key(|inlay_hint| inlay_hint.position);
+            hints.sort_by_key(|inlay_hint| inlay_hint.position);
 
             let mut padding_before_inlay_hints = Vec::new();
             let mut type_inlay_hints = Vec::new();