summaryrefslogtreecommitdiff
path: root/helix-term/src/commands/lsp.rs
diff options
context:
space:
mode:
authorMichael Davis2022-10-10 20:15:37 +0000
committerBlaž Hrastnik2022-10-11 03:17:32 +0000
commitc388e16e09b36c665c4f92db4f7a071e7c1d9761 (patch)
tree40bf9fe3dbacaac21a131bb67c896d9395930d64 /helix-term/src/commands/lsp.rs
parent0aedef03334dfc0cb2a723cce23abc5b4ca55a22 (diff)
Add a helper function for applying transactions
It is easy to forget to call `Document::apply` and/or `View::apply` in the correct order. This commit introduces a helper function which closes over both calls.
Diffstat (limited to 'helix-term/src/commands/lsp.rs')
-rw-r--r--helix-term/src/commands/lsp.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs
index 726aec67..3fa5c96f 100644
--- a/helix-term/src/commands/lsp.rs
+++ b/helix-term/src/commands/lsp.rs
@@ -9,7 +9,7 @@ use tui::text::{Span, Spans};
use super::{align_view, push_jump, Align, Context, Editor, Open};
use helix_core::{path, Selection};
-use helix_view::{editor::Action, theme::Style};
+use helix_view::{apply_transaction, editor::Action, theme::Style};
use crate::{
compositor::{self, Compositor},
@@ -617,8 +617,7 @@ pub fn apply_workspace_edit(
text_edits,
offset_encoding,
);
- doc.apply(&transaction, view_id);
- view_mut!(editor, view_id).apply(&transaction, doc);
+ apply_transaction(&transaction, doc, view_mut!(editor, view_id));
doc.append_changes_to_history(view_id);
};