Use tree-sitter when returning symbols to the model for a given file (#28352)

This also increases the threshold for when we return an outline during
`read_file`.

Release Notes:

- Fixed an issue that caused the agent to fail reading large files if
the LSP hadn't started yet.
This commit is contained in:
Antonio Scandurra 2025-04-08 14:11:05 -06:00 committed by GitHub
parent ca8f6e8a3f
commit 97641c3298
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 46 additions and 218 deletions

View file

@ -1,7 +1,6 @@
use std::sync::Arc;
use crate::code_symbols_tool::file_outline;
use crate::schema::json_schema_for;
use crate::{code_symbols_tool::file_outline, schema::json_schema_for};
use anyhow::{Result, anyhow};
use assistant_tool::{ActionLog, Tool};
use gpui::{App, Entity, Task};
@ -16,7 +15,7 @@ use util::markdown::MarkdownString;
/// If the model requests to read a file whose size exceeds this, then
/// the tool will return an error along with the model's symbol outline,
/// and suggest trying again using line ranges from the outline.
const MAX_FILE_SIZE_TO_READ: usize = 4096;
const MAX_FILE_SIZE_TO_READ: usize = 16384;
#[derive(Debug, Serialize, Deserialize, JsonSchema)]
pub struct ReadFileToolInput {