aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
authorLuca Schlecker2023-06-07 12:18:25 +0000
committerSkyler Hawthorne2023-06-09 17:23:29 +0000
commitdbd248fdfa680373d94fbc10094a160aafa0f7a7 (patch)
treed5fd76903c9f4b445cdb360713686bd447e9299a /helix-term/src/ui
parent00b152facd8cc9d671f1781a3b931bcc9830efce (diff)
add config option for instant completion entry preview (defaulting to true).
Signed-off-by: Luca Schlecker <luca.schlecker@hotmail.com>
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/completion.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs
index d997e8ae..1ebcd192 100644
--- a/helix-term/src/ui/completion.rs
+++ b/helix-term/src/ui/completion.rs
@@ -110,6 +110,7 @@ impl Completion {
start_offset: usize,
trigger_offset: usize,
) -> Self {
+ let preview_completion_insert = editor.config().preview_completion_insert;
let replace_mode = editor.config().completion_replace;
// Sort completion items according to their preselect status (given by the LSP server)
items.sort_by_key(|item| !item.item.preselect.unwrap_or(false));
@@ -230,7 +231,7 @@ impl Completion {
match event {
PromptEvent::Abort => {}
- PromptEvent::Update => {
+ PromptEvent::Update if preview_completion_insert => {
// Update creates "ghost" transactions which are not sent to the
// lsp server to avoid messing up re-requesting completions. Once a
// completion has been selected (with tab, c-n or c-p) it's always accepted whenever anything
@@ -263,6 +264,7 @@ impl Completion {
);
doc.apply_temporary(&transaction, view.id);
}
+ PromptEvent::Update => {}
PromptEvent::Validate => {
if let Some(CompleteAction::Selected { savepoint }) =
editor.last_completion.take()