diff options
Diffstat (limited to 'helix-lsp')
-rw-r--r-- | helix-lsp/src/lib.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index f33646c8..2bc554e6 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -173,9 +173,13 @@ pub mod util { pub fn generate_transaction_from_edits( doc: &Rope, - edits: Vec<lsp::TextEdit>, + mut edits: Vec<lsp::TextEdit>, offset_encoding: OffsetEncoding, ) -> Transaction { + // Sort edits by start range, since some LSPs (Omnisharp) send them + // in reverse order. + edits.sort_unstable_by_key(|edit| edit.range.start); + Transaction::change( doc, edits.into_iter().map(|edit| { |