assistant_tool: Decouple Tool from Workspace (#26309)

This PR decouples the `Tool` trait from the `Workspace` (and from the
UI, in general).

`Tool::run` now takes a `WeakEntity<Project>` instead of a
`WeakEntity<Workspace>` and a `Window`.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-03-07 17:41:56 -05:00 committed by GitHub
parent 4f6682c7fe
commit 18f3f8097f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 35 additions and 52 deletions

View file

@ -17,6 +17,6 @@ collections.workspace = true
derive_more.workspace = true
gpui.workspace = true
parking_lot.workspace = true
project.workspace = true
serde.workspace = true
serde_json.workspace = true
workspace.workspace = true

View file

@ -4,8 +4,8 @@ mod tool_working_set;
use std::sync::Arc;
use anyhow::Result;
use gpui::{App, Task, WeakEntity, Window};
use workspace::Workspace;
use gpui::{App, Task, WeakEntity};
use project::Project;
pub use crate::tool_registry::*;
pub use crate::tool_working_set::*;
@ -31,8 +31,7 @@ pub trait Tool: 'static + Send + Sync {
fn run(
self: Arc<Self>,
input: serde_json::Value,
workspace: WeakEntity<Workspace>,
window: &mut Window,
project: WeakEntity<Project>,
cx: &mut App,
) -> Task<Result<String>>;
}