on master help sign in
clarify comments about completion savepoints
6842fd4Pascal Kuthe
helix-term/src/ui/completion.rs+7−7
@@ -226,14 +226,14 @@ impl Completion {
226 match event {
226 match event {
227 PromptEvent::Abort => {}
227 PromptEvent::Abort => {}
228 PromptEvent::Update => {
228 PromptEvent::Update => {
229− // Update creates "ghost" transactiosn which are not send to the
229+ // Update creates "ghost" transactions which are not sent to the
230− // lsp server to avoid messing up rerequesting completions. Once a
230+ // lsp server to avoid messing up re-requesting completions. Once a
231− // completion has been selected (with) tab it's always accepted whenever anything
231+ // completion has been selected (with tab, c-n or c-p) it's always accepted whenever anything
232 // is typed. The only way to avoid that is to explicitly abort the completion
232 // 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.
234 //
234 //
235− // The ghost transaction is modeled with a transaction that is not send to the LS.
235+ // The ghost transaction is modeled with a transaction that is not sent to the LS.
236− // (apply_temporary) and a savepoint. It's extremly important this savepoint is restored
236+ // (apply_temporary) and a savepoint. It's extremely important this savepoint is restored
237 // (also without sending the transaction to the LS) *before any further transaction is applied*.
237 // (also without sending the transaction to the LS) *before any further transaction is applied*.
238 // Otherwise incremental sync breaks (since the state of the LS doesn't match the state the transaction
238 // Otherwise incremental sync breaks (since the state of the LS doesn't match the state the transaction
239 // is applied to).
239 // is applied to).
@@ -293,7 +293,7 @@ impl Completion {
293 changes: completion_changes(&transaction, trigger_offset),
293 changes: completion_changes(&transaction, trigger_offset),
294 });
294 });
295
295
296− // TOOD: add additional _edits to completion_changes?
296+ // TODO: add additional _edits to completion_changes?
297 if let Some(additional_edits) = item.item.additional_text_edits {
297 if let Some(additional_edits) = item.item.additional_text_edits {
298 if !additional_edits.is_empty() {
298 if !additional_edits.is_empty() {
299 let transaction = util::generate_transaction_from_edits(
299 let transaction = util::generate_transaction_from_edits(
helix-view/src/document.rs+1−1
@@ -1197,7 +1197,7 @@ impl Document {
1197 self.apply_inner(transaction, view_id, true)
1197 self.apply_inner(transaction, view_id, true)
1198 }
1198 }
1199
1199
1200− /// Apply a [`Transaction`] to the [`Document`] to change its text.
1200+ /// Apply a [`Transaction`] to the [`Document`] to change its text
1201 /// without notifying the language servers. This is useful for temporary transactions
1201 /// without notifying the language servers. This is useful for temporary transactions
1202 /// that must not influence the server.
1202 /// that must not influence the server.
1203 pub fn apply_temporary(&mut self, transaction: &Transaction, view_id: ViewId) -> bool {
1203 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 {
911 trigger_offset: usize,
911 trigger_offset: usize,
912 changes: Vec<Change>,
912 changes: Vec<Change>,
913 },
913 },
914− /// A savepoint of the currently active completion. The completion
914+ /// A savepoint of the currently selected completion. The savepoint
915 /// MUST be restored before sending any event to the LSP
915 /// MUST be restored before sending any event to the LSP
916 Selected { savepoint: Arc<SavePoint> },
916 Selected { savepoint: Arc<SavePoint> },
917}
917}