@@ -110,6 +110,7 @@ impl Completion {
110 start_offset: usize,
110 start_offset: usize,
111 trigger_offset: usize,
111 trigger_offset: usize,
112 ) -> Self {
112 ) -> Self {
113+ let preview_completion_insert = editor.config().preview_completion_insert;
113 let replace_mode = editor.config().completion_replace;
114 let replace_mode = editor.config().completion_replace;
114 // Sort completion items according to their preselect status (given by the LSP server)
115 // Sort completion items according to their preselect status (given by the LSP server)
115 items.sort_by_key(|item| !item.item.preselect.unwrap_or(false));
116 items.sort_by_key(|item| !item.item.preselect.unwrap_or(false));
@@ -230,7 +231,7 @@ impl Completion {
231 match event {
232 match event {
232 PromptEvent::Abort => {}
233 PromptEvent::Abort => {}
233− PromptEvent::Update => {
234+ PromptEvent::Update if preview_completion_insert => {
234 // Update creates "ghost" transactions which are not sent to the
235 // Update creates "ghost" transactions which are not sent to the
235 // lsp server to avoid messing up re-requesting completions. Once a
236 // lsp server to avoid messing up re-requesting completions. Once a
236 // completion has been selected (with tab, c-n or c-p) it's always accepted whenever anything
237 // completion has been selected (with tab, c-n or c-p) it's always accepted whenever anything
@@ -263,6 +264,7 @@ impl Completion {
264 doc.apply_temporary(&transaction, view.id);
265 doc.apply_temporary(&transaction, view.id);
267+ PromptEvent::Update => {}
266 PromptEvent::Validate => {
268 PromptEvent::Validate => {
267 if let Some(CompleteAction::Selected { savepoint }) =
269 if let Some(CompleteAction::Selected { savepoint }) =
268 editor.last_completion.take()
270 editor.last_completion.take()