From 6842fd4c36c5855023b007a36b0b5c8bd965d8de Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Fri, 7 Apr 2023 14:50:47 +0200 Subject: [PATCH] clarify comments about completion savepoints Co-authored-by: Michael Davis --- helix-term/src/ui/completion.rs | 14 +++++++------- helix-view/src/document.rs | 2 +- helix-view/src/editor.rs | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs index c736f043f..c5c405801 100644 --- a/helix-term/src/ui/completion.rs +++ b/helix-term/src/ui/completion.rs @@ -226,14 +226,14 @@ impl Completion { match event { PromptEvent::Abort => {} PromptEvent::Update => { - // Update creates "ghost" transactiosn which are not send to the - // lsp server to avoid messing up rerequesting completions. Once a - // completion has been selected (with) tab it's always accepted whenever anything + // 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 // is typed. The only way to avoid that is to explicitly abort the completion - // with esc/c-c. This will remove the "ghost" transaction. + // with c-c. This will remove the "ghost" transaction. // - // The ghost transaction is modeled with a transaction that is not send to the LS. - // (apply_temporary) and a savepoint. It's extremly important this savepoint is restored + // The ghost transaction is modeled with a transaction that is not sent to the LS. + // (apply_temporary) and a savepoint. It's extremely important this savepoint is restored // (also without sending the transaction to the LS) *before any further transaction is applied*. // Otherwise incremental sync breaks (since the state of the LS doesn't match the state the transaction // is applied to). @@ -293,7 +293,7 @@ impl Completion { changes: completion_changes(&transaction, trigger_offset), }); - // TOOD: add additional _edits to completion_changes? + // TODO: add additional _edits to completion_changes? if let Some(additional_edits) = item.item.additional_text_edits { if !additional_edits.is_empty() { let transaction = util::generate_transaction_from_edits( diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 4d8e61e1d..e29e52cc5 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -1197,7 +1197,7 @@ impl Document { self.apply_inner(transaction, view_id, true) } - /// Apply a [`Transaction`] to the [`Document`] to change its text. + /// Apply a [`Transaction`] to the [`Document`] to change its text /// without notifying the language servers. This is useful for temporary transactions /// that must not influence the server. pub fn apply_temporary(&mut self, transaction: &Transaction, view_id: ViewId) -> bool { diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 43227c5f1..9546d460b 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -911,7 +911,7 @@ pub enum CompleteAction { trigger_offset: usize, changes: Vec, }, - /// A savepoint of the currently active completion. The completion + /// A savepoint of the currently selected completion. The savepoint /// MUST be restored before sending any event to the LSP Selected { savepoint: Arc }, }