aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/handlers/lsp.rs
blob: 9583856468ef3b866c996dba1a1cc54809ddae5e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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 },
}