From 8e592a151fe7adfbf3fb35ae134b7f2a70700f09 Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Fri, 1 Dec 2023 00:03:27 +0100 Subject: refactor completion and signature help using hooks --- helix-view/src/handlers/lsp.rs | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'helix-view/src/handlers/lsp.rs') diff --git a/helix-view/src/handlers/lsp.rs b/helix-view/src/handlers/lsp.rs index 95838564..1dae45dd 100644 --- a/helix-view/src/handlers/lsp.rs +++ b/helix-view/src/handlers/lsp.rs @@ -1,26 +1,27 @@ 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), + AutoTrigger { + cursor: usize, + doc: DocumentId, + view: ViewId, + }, + /// Auto completion was triggered by typing a trigger char + /// specified by the LSP + TriggerChar { + cursor: usize, + doc: DocumentId, + view: ViewId, + }, /// A completion was manually requested (c-x) - Manual, + ManualTrigger { + cursor: usize, + doc: DocumentId, + view: ViewId, + }, /// Some text was deleted and the cursor is now at `pos` - DeleteText { pos: usize }, + DeleteText { cursor: usize }, /// Invalidate the current auto completion trigger Cancel, } -- cgit v1.2.3-70-g09d2