agent: Introduce agent_buffer_font_size setting (#39468)

Closes https://github.com/zed-industries/zed/issues/39406
Follow up to https://github.com/zed-industries/zed/pull/38726

This PR introduces the `agent_buffer_font_size` setting and renames
`agent_font_size` to `agent_ui_font_size`. This allows whoever wants
`buffer_font_size` and `agent_buffer_font_size` to match, as well as
folks who want a slightly smaller size only in the agent panel (which...
also looks just better by default!).

Release Notes:

- agent: Introduced the `agent_buffer_font_size` setting and renamed
`agent_font_size` to `agent_ui_font_size`, allowing for granular buffer
font size control in the agent panel vs. regular editors.
This commit is contained in:
Danilo Leal
2025-10-03 14:23:23 -03:00
committed by GitHub
parent 504216cbbf
commit f499504b13
12 changed files with 138 additions and 40 deletions
+6
View File
@@ -111,3 +111,9 @@ pub(crate) mod m_2025_10_02 {
pub(crate) use settings::remove_formatters_on_save;
}
pub(crate) mod m_2025_10_03 {
mod settings;
pub(crate) use settings::SETTINGS_PATTERNS;
}
@@ -0,0 +1,30 @@
use std::ops::Range;
use tree_sitter::{Query, QueryMatch};
use crate::MigrationPatterns;
use crate::patterns::SETTINGS_ROOT_KEY_VALUE_PATTERN;
pub const SETTINGS_PATTERNS: MigrationPatterns =
&[(SETTINGS_ROOT_KEY_VALUE_PATTERN, rename_agent_font_size)];
/// Renames the setting `agent_font_size` to `agent_ui_font_size`
fn rename_agent_font_size(
contents: &str,
mat: &QueryMatch,
query: &Query,
) -> Option<(Range<usize>, String)> {
let setting_capture_ix = query.capture_index_for_name("name")?;
let setting_name_range = mat
.nodes_for_capture_index(setting_capture_ix)
.next()?
.byte_range();
let setting_name = contents.get(setting_name_range.clone())?;
if setting_name != "agent_font_size" {
return None;
}
Some((setting_name_range, "agent_ui_font_size".to_string()))
}
+8
View File
@@ -200,6 +200,10 @@ pub fn migrate_settings(text: &str) -> Result<Option<String>> {
&SETTINGS_QUERY_2025_10_01,
),
MigrationType::Json(migrations::m_2025_10_02::remove_formatters_on_save),
MigrationType::TreeSitter(
migrations::m_2025_10_03::SETTINGS_PATTERNS,
&SETTINGS_QUERY_2025_10_03,
),
];
run_migrations(text, migrations)
}
@@ -318,6 +322,10 @@ define_query!(
SETTINGS_QUERY_2025_10_01,
migrations::m_2025_10_01::SETTINGS_PATTERNS
);
define_query!(
SETTINGS_QUERY_2025_10_03,
migrations::m_2025_10_03::SETTINGS_PATTERNS
);
// custom query
static EDIT_PREDICTION_SETTINGS_MIGRATION_QUERY: LazyLock<Query> = LazyLock::new(|| {