aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/handlers/lsp.rs
diff options
context:
space:
mode:
authorPascal Kuthe2023-11-30 23:03:26 +0000
committerBlaž Hrastnik2024-01-23 02:20:19 +0000
commit13ed4f6c4748019787d24c2b686d417b71604242 (patch)
tree8263b77ee05a22dfc85410345069efb3668b1877 /helix-view/src/handlers/lsp.rs
parent7d7ace551cd58f0b6d65af7a6dfa8f896d94724a (diff)
Add hook/event system
Diffstat (limited to 'helix-view/src/handlers/lsp.rs')
-rw-r--r--helix-view/src/handlers/lsp.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/helix-view/src/handlers/lsp.rs b/helix-view/src/handlers/lsp.rs
index 8b137891..95838564 100644
--- a/helix-view/src/handlers/lsp.rs
+++ b/helix-view/src/handlers/lsp.rs
@@ -1 +1,40 @@
+use crate::{DocumentId, ViewId};
+#[derive(Debug, Clone, Copy)]
+pub struct CompletionTrigger {
+ /// The char position of the primary cursor when the
+ /// completion was triggered
+ pub trigger_pos: usize,
+ pub doc: DocumentId,
+ pub view: ViewId,
+ /// Whether the cause of the trigger was an automatic completion (any word
+ /// char for words longer than minimum word length).
+ /// This is false for trigger chars send by the LS
+ pub auto: bool,
+}
+
+pub enum CompletionEvent {
+ /// Auto completion was triggered by typing a word char
+ /// or a completion trigger
+ Trigger(CompletionTrigger),
+ /// A completion was manually requested (c-x)
+ Manual,
+ /// Some text was deleted and the cursor is now at `pos`
+ DeleteText { pos: usize },
+ /// Invalidate the current auto completion trigger
+ Cancel,
+}
+
+#[derive(Debug, PartialEq, Eq, Clone, Copy)]
+pub enum SignatureHelpInvoked {
+ Automatic,
+ Manual,
+}
+
+pub enum SignatureHelpEvent {
+ Invoked,
+ Trigger,
+ ReTrigger,
+ Cancel,
+ RequestComplete { open: bool },
+}