Introduce DiagnosticsTool (#26670)

Release Notes:

- N/A
This commit is contained in:
Antonio Scandurra 2025-03-13 14:53:00 +01:00 committed by GitHub
parent 247ee880d2
commit 8cf5af1a84
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 167 additions and 49 deletions

View file

@ -11,7 +11,7 @@ use language_model::{
LanguageModelRegistry, LanguageModelRequest, LanguageModelRequestMessage, Role,
};
use log::{EditToolLog, EditToolRequestId};
use project::{Project, ProjectPath};
use project::Project;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use std::fmt::Write;
@ -178,23 +178,9 @@ impl EditFilesTool {
for action in new_actions {
let project_path = project.read_with(&cx, |project, cx| {
let worktree_root_name = action
.file_path()
.components()
.next()
.context("Invalid path")?;
let worktree = project
.worktree_for_root_name(
&worktree_root_name.as_os_str().to_string_lossy(),
cx,
)
.context("Directory not found in project")?;
anyhow::Ok(ProjectPath {
worktree_id: worktree.read(cx).id(),
path: Arc::from(
action.file_path().strip_prefix(worktree_root_name).unwrap(),
),
})
project
.find_project_path(action.file_path(), cx)
.context("Path not found in project")
})??;
let buffer = project