fix: lsp: Sort edits by start range, Omnisharp sends them in reverse

pull/2647/head
Blaž Hrastnik 3 years ago
parent 99e08f50bd
commit 3d91c99c3e
No known key found for this signature in database
GPG Key ID: 1238B9C4AD889640

@ -173,9 +173,13 @@ pub mod util {
pub fn generate_transaction_from_edits( pub fn generate_transaction_from_edits(
doc: &Rope, doc: &Rope,
edits: Vec<lsp::TextEdit>, mut edits: Vec<lsp::TextEdit>,
offset_encoding: OffsetEncoding, offset_encoding: OffsetEncoding,
) -> Transaction { ) -> 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( Transaction::change(
doc, doc,
edits.into_iter().map(|edit| { edits.into_iter().map(|edit| {

Loading…
Cancel
Save