on master help sign in
clarify comments about completion savepoints

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

commit6842fd4c36c5855023b007a36b0b5c8bd965d8de authorPascal Kuthe <pascal.kuthe@semimod.de> dateFri 7 Apr 2023, 14:50 (4 years ago) parent28b7303
3 files changed+9−9
helix-term/src/ui/completion.rs+7−7 helix-view/src/document.rs+1−1 helix-view/src/editor.rs+1−1
helix-term/src/ui/completion.rs+7−7
@@ -226,14 +226,14 @@ impl Completion {
226226 match event {
227227 PromptEvent::Abort => {}
228228 PromptEvent::Update => {
229− // Update creates "ghost" transactiosn which are not send to the
230− // lsp server to avoid messing up rerequesting completions. Once a
231− // completion has been selected (with) tab it's always accepted whenever anything
229+ // Update creates "ghost" transactions which are not sent to the
230+ // lsp server to avoid messing up re-requesting completions. Once a
231+ // completion has been selected (with tab, c-n or c-p) it's always accepted whenever anything
232232 // is typed. The only way to avoid that is to explicitly abort the completion
233− // with esc/c-c. This will remove the "ghost" transaction.
233+ // with c-c. This will remove the "ghost" transaction.
234234 //
235− // The ghost transaction is modeled with a transaction that is not send to the LS.
236− // (apply_temporary) and a savepoint. It's extremly important this savepoint is restored
235+ // The ghost transaction is modeled with a transaction that is not sent to the LS.
236+ // (apply_temporary) and a savepoint. It's extremely important this savepoint is restored
237237 // (also without sending the transaction to the LS) *before any further transaction is applied*.
238238 // Otherwise incremental sync breaks (since the state of the LS doesn't match the state the transaction
239239 // is applied to).
@@ -293,7 +293,7 @@ impl Completion {
293293 changes: completion_changes(&transaction, trigger_offset),
294294 });
295295
296− // TOOD: add additional _edits to completion_changes?
296+ // TODO: add additional _edits to completion_changes?
297297 if let Some(additional_edits) = item.item.additional_text_edits {
298298 if !additional_edits.is_empty() {
299299 let transaction = util::generate_transaction_from_edits(
helix-view/src/document.rs+1−1
@@ -1197,7 +1197,7 @@ impl Document {
11971197 self.apply_inner(transaction, view_id, true)
11981198 }
11991199
1200− /// Apply a [`Transaction`] to the [`Document`] to change its text.
1200+ /// Apply a [`Transaction`] to the [`Document`] to change its text
12011201 /// without notifying the language servers. This is useful for temporary transactions
12021202 /// that must not influence the server.
12031203 pub fn apply_temporary(&mut self, transaction: &Transaction, view_id: ViewId) -> bool {
helix-view/src/editor.rs+1−1
@@ -911,7 +911,7 @@ pub enum CompleteAction {
911911 trigger_offset: usize,
912912 changes: Vec<Change>,
913913 },
914− /// A savepoint of the currently active completion. The completion
914+ /// A savepoint of the currently selected completion. The savepoint
915915 /// MUST be restored before sending any event to the LSP
916916 Selected { savepoint: Arc<SavePoint> },
917917}