Unnamed repository; edit this file 'description' to name the repository.
add `changes` and `ghost_transaction` to DocumentDidChange events
Pascal Kuthe 2024-12-18
parent c8c0d04 · commit 5537e68
-rw-r--r--helix-term/src/handlers/signature_help.rs2
-rw-r--r--helix-view/src/document.rs2
-rw-r--r--helix-view/src/events.rs10
3 files changed, 11 insertions, 3 deletions
diff --git a/helix-term/src/handlers/signature_help.rs b/helix-term/src/handlers/signature_help.rs
index e4f7e935..cc7392e3 100644
--- a/helix-term/src/handlers/signature_help.rs
+++ b/helix-term/src/handlers/signature_help.rs
@@ -353,7 +353,7 @@ pub(super) fn register_hooks(handlers: &Handlers) {
let tx = handlers.signature_hints.clone();
register_hook!(move |event: &mut DocumentDidChange<'_>| {
- if event.doc.config.load().lsp.auto_signature_help {
+ if event.doc.config.load().lsp.auto_signature_help && !event.ghost_transaction {
send_blocking(&tx, SignatureHelpEvent::ReTrigger);
}
Ok(())
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index fa089cda..310f2715 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -1412,6 +1412,8 @@ impl Document {
doc: self,
view: view_id,
old_text: &old_doc,
+ changes,
+ ghost_transaction: !emit_lsp_notification,
});
// if specified, the current selection should instead be replaced by transaction.selection
diff --git a/helix-view/src/events.rs b/helix-view/src/events.rs
index 88141249..136d60c5 100644
--- a/helix-view/src/events.rs
+++ b/helix-view/src/events.rs
@@ -1,10 +1,16 @@
-use helix_core::Rope;
+use helix_core::{ChangeSet, Rope};
use helix_event::events;
use crate::{Document, DocumentId, Editor, ViewId};
events! {
- DocumentDidChange<'a> { doc: &'a mut Document, view: ViewId, old_text: &'a Rope }
+ DocumentDidChange<'a> {
+ doc: &'a mut Document,
+ view: ViewId,
+ old_text: &'a Rope,
+ changes: &'a ChangeSet,
+ ghost_transaction: bool
+ }
SelectionDidChange<'a> { doc: &'a mut Document, view: ViewId }
DiagnosticsDidChange<'a> { editor: &'a mut Editor, doc: DocumentId }
}