Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Standardize on canceled instead of cancelled (#36385)
Ben Brandtb3969ed427d4
diff --git a/Cargo.lock b/Cargo.lockindex b4bf705eb9a..a4f8c521a1e 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -172,9 +172,9 @@ dependencies = [[[package]]name = "agent-client-protocol"-version = "0.0.25"+version = "0.0.26"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2ab66add8be8d6a963f5bf4070045c1bbf36472837654c73e2298dd16bda5bf7"+checksum = "160971bb53ca0b2e70ebc857c21e24eb448745f1396371015f4c59e9a9e51ed0"dependencies = ["anyhow","futures 0.3.31",diff --git a/Cargo.toml b/Cargo.tomlindex b3105bd97c9..14691cf8a4f 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -423,7 +423,7 @@ zlog_settings = { path = "crates/zlog_settings" }#agentic-coding-protocol = "0.0.10"-agent-client-protocol = "0.0.25"+agent-client-protocol = "0.0.26"aho-corasick = "1.1"alacritty_terminal = { git = "https://github.com/zed-industries/alacritty.git", branch = "add-hush-login-flag" }any_vec = "0.14"diff --git a/crates/acp_thread/src/acp_thread.rs b/crates/acp_thread/src/acp_thread.rsindex c1c634612b4..fb312653265 100644--- a/crates/acp_thread/src/acp_thread.rs+++ b/crates/acp_thread/src/acp_thread.rs@@ -360,7 +360,7 @@ pub enum ToolCallStatus {Failed,/// The user rejected the tool call.Rejected,- /// The user cancelled generation so the tool call was cancelled.+ /// The user canceled generation so the tool call was canceled.Canceled,}@@ -1269,19 +1269,19 @@ impl AcpThread {Err(e)}result => {- let cancelled = matches!(+ let canceled = matches!(result,Ok(Ok(acp::PromptResponse {- stop_reason: acp::StopReason::Cancelled+ stop_reason: acp::StopReason::Canceled})));- // We only take the task if the current prompt wasn't cancelled.+ // We only take the task if the current prompt wasn't canceled.//- // This prompt may have been cancelled because another one was sent+ // This prompt may have been canceled because another one was sent// while it was still generating. In these cases, dropping `send_task`- // would cause the next generation to be cancelled.- if !cancelled {+ // would cause the next generation to be canceled.+ if !canceled {this.send_task.take();}diff --git a/crates/agent/src/thread.rs b/crates/agent/src/thread.rsindex f3f10884830..54918421851 100644--- a/crates/agent/src/thread.rs+++ b/crates/agent/src/thread.rs@@ -5337,7 +5337,7 @@ fn main() {{}#[gpui::test]- async fn test_retry_cancelled_on_stop(cx: &mut TestAppContext) {+ async fn test_retry_canceled_on_stop(cx: &mut TestAppContext) {init_test_settings(cx);let project = create_test_project(cx, json!({})).await;@@ -5393,7 +5393,7 @@ fn main() {{"Should have no pending completions after cancellation");- // Verify the retry was cancelled by checking retry state+ // Verify the retry was canceled by checking retry statethread.read_with(cx, |thread, _| {if let Some(retry_state) = &thread.retry_state {panic!(diff --git a/crates/agent/src/tool_use.rs b/crates/agent/src/tool_use.rsindex 7392c0878d1..74dfaf9a858 100644--- a/crates/agent/src/tool_use.rs+++ b/crates/agent/src/tool_use.rs@@ -137,7 +137,7 @@ impl ToolUseState {}pub fn cancel_pending(&mut self) -> Vec<PendingToolUse> {- let mut cancelled_tool_uses = Vec::new();+ let mut canceled_tool_uses = Vec::new();self.pending_tool_uses_by_id.retain(|tool_use_id, tool_use| {if matches!(tool_use.status, PendingToolUseStatus::Error { .. }) {@@ -155,10 +155,10 @@ impl ToolUseState {is_error: true,},);- cancelled_tool_uses.push(tool_use.clone());+ canceled_tool_uses.push(tool_use.clone());false});- cancelled_tool_uses+ canceled_tool_uses}pub fn pending_tool_uses(&self) -> Vec<&PendingToolUse> {diff --git a/crates/agent_servers/src/acp/v1.rs b/crates/agent_servers/src/acp/v1.rsindex 506ae80886c..b77b5ef36d2 100644--- a/crates/agent_servers/src/acp/v1.rs+++ b/crates/agent_servers/src/acp/v1.rs@@ -237,7 +237,7 @@ impl acp::Client for ClientDelegate {let outcome = match result {Ok(option) => acp::RequestPermissionOutcome::Selected { option_id: option },- Err(oneshot::Canceled) => acp::RequestPermissionOutcome::Cancelled,+ Err(oneshot::Canceled) => acp::RequestPermissionOutcome::Canceled,};Ok(acp::RequestPermissionResponse { outcome })diff --git a/crates/agent_servers/src/claude.rs b/crates/agent_servers/src/claude.rsindex 4b3a1733491..d15cc1dd89f 100644--- a/crates/agent_servers/src/claude.rs+++ b/crates/agent_servers/src/claude.rs@@ -285,7 +285,7 @@ impl AgentConnection for ClaudeAgentConnection {let turn_state = session.turn_state.take();let TurnState::InProgress { end_tx } = turn_state else {- // Already cancelled or idle, put it back+ // Already canceled or idle, put it backsession.turn_state.replace(turn_state);return;};@@ -389,7 +389,7 @@ enum TurnState {}impl TurnState {- fn is_cancelled(&self) -> bool {+ fn is_canceled(&self) -> bool {matches!(self, TurnState::CancelConfirmed { .. })}@@ -439,7 +439,7 @@ impl ClaudeAgentSession {for chunk in message.content.chunks() {match chunk {ContentChunk::Text { text } | ContentChunk::UntaggedText(text) => {- if !turn_state.borrow().is_cancelled() {+ if !turn_state.borrow().is_canceled() {thread.update(cx, |thread, cx| {thread.push_user_content_block(None, text.into(), cx)@@ -458,8 +458,8 @@ impl ClaudeAgentSession {acp::ToolCallUpdate {id: acp::ToolCallId(tool_use_id.into()),fields: acp::ToolCallUpdateFields {- status: if turn_state.borrow().is_cancelled() {- // Do not set to completed if turn was cancelled+ status: if turn_state.borrow().is_canceled() {+ // Do not set to completed if turn was canceledNone} else {Some(acp::ToolCallStatus::Completed)@@ -592,14 +592,13 @@ impl ClaudeAgentSession {..} => {let turn_state = turn_state.take();- let was_cancelled = turn_state.is_cancelled();+ let was_canceled = turn_state.is_canceled();let Some(end_turn_tx) = turn_state.end_tx() else {debug_panic!("Received `SdkMessage::Result` but there wasn't an active turn");return;};- if is_error || (!was_cancelled && subtype == ResultErrorType::ErrorDuringExecution)- {+ if is_error || (!was_canceled && subtype == ResultErrorType::ErrorDuringExecution) {end_turn_tx.send(Err(anyhow!("Error: {}",@@ -610,7 +609,7 @@ impl ClaudeAgentSession {let stop_reason = match subtype {ResultErrorType::Success => acp::StopReason::EndTurn,ResultErrorType::ErrorMaxTurns => acp::StopReason::MaxTurnRequests,- ResultErrorType::ErrorDuringExecution => acp::StopReason::Cancelled,+ ResultErrorType::ErrorDuringExecution => acp::StopReason::Canceled,};end_turn_tx.send(Ok(acp::PromptResponse { stop_reason }))diff --git a/crates/agent_ui/src/active_thread.rs b/crates/agent_ui/src/active_thread.rsindex ffed62d41ff..116c2b901bb 100644--- a/crates/agent_ui/src/active_thread.rs+++ b/crates/agent_ui/src/active_thread.rs@@ -4020,7 +4020,7 @@ mod tests {cx.run_until_parked();- // Verify that the previous completion was cancelled+ // Verify that the previous completion was canceledassert_eq!(cancellation_events.lock().unwrap().len(), 1);// Verify that a new request was started after cancellationdiff --git a/crates/agent_ui/src/message_editor.rs b/crates/agent_ui/src/message_editor.rsindex 127e9256be0..d6c9a778a60 100644--- a/crates/agent_ui/src/message_editor.rs+++ b/crates/agent_ui/src/message_editor.rs@@ -441,11 +441,11 @@ impl MessageEditor {thread.cancel_editing(cx);});- let cancelled = self.thread.update(cx, |thread, cx| {+ let canceled = self.thread.update(cx, |thread, cx| {thread.cancel_last_completion(Some(window.window_handle()), cx)});- if cancelled {+ if canceled {self.set_editor_is_expanded(false, cx);self.send_to_model(window, cx);}@@ -1404,7 +1404,7 @@ impl MessageEditor {}).ok();});- // Replace existing load task, if any, causing it to be cancelled.+ // Replace existing load task, if any, causing it to be canceled.let load_task = load_task.shared();self.load_context_task = Some(load_task.clone());cx.spawn(async move |this, cx| {