Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

agent: Make assistant panel input size configurable (#37975)

Owen Kelly6446963a0ca9
diff --git a/assets/settings/default.json b/assets/settings/default.json
index 5dcb418184f..daab56dc939 100644
--- a/assets/settings/default.json
+++ b/assets/settings/default.json
@@ -914,7 +914,11 @@
/// Whether to have terminal cards in the agent panel expanded, showing the whole command output.
///
/// Default: true
- "expand_terminal_card": true
+ "expand_terminal_card": true,
+ // Minimum number of lines to display in the agent message editor.
+ //
+ // Default: 4
+ "message_editor_min_lines": 4
},
// The settings for slash commands.
"slash_commands": {
diff --git a/crates/agent_settings/src/agent_settings.rs b/crates/agent_settings/src/agent_settings.rs
index e850945a40f..153b64a3950 100644
--- a/crates/agent_settings/src/agent_settings.rs
+++ b/crates/agent_settings/src/agent_settings.rs
@@ -75,6 +75,7 @@ pub struct AgentSettings {
pub expand_edit_card: bool,
pub expand_terminal_card: bool,
pub use_modifier_to_send: bool,
+ pub message_editor_min_lines: usize,
}
impl AgentSettings {
@@ -107,6 +108,10 @@ impl AgentSettings {
model,
});
}
+
+ pub fn set_message_editor_max_lines(&self) -> usize {
+ self.message_editor_min_lines * 2
+ }
}
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)]
@@ -320,6 +325,10 @@ pub struct AgentSettingsContent {
///
/// Default: false
use_modifier_to_send: Option<bool>,
+ /// Minimum number of lines of height the agent message editor should have.
+ ///
+ /// Default: 4
+ message_editor_min_lines: Option<usize>,
}
#[derive(Clone, Copy, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Default)]
@@ -472,6 +481,10 @@ impl Settings for AgentSettings {
&mut settings.use_modifier_to_send,
value.use_modifier_to_send,
);
+ merge(
+ &mut settings.message_editor_min_lines,
+ value.message_editor_min_lines,
+ );
settings
.model_parameters
diff --git a/crates/agent_ui/src/acp/thread_view.rs b/crates/agent_ui/src/acp/thread_view.rs
index ceed3f8f98f..73b1fee3caa 100644
--- a/crates/agent_ui/src/acp/thread_view.rs
+++ b/crates/agent_ui/src/acp/thread_view.rs
@@ -71,9 +71,6 @@ use crate::{
RejectOnce, ToggleBurnMode, ToggleProfileSelector,
};
-pub const MIN_EDITOR_LINES: usize = 4;
-pub const MAX_EDITOR_LINES: usize = 8;
-
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
enum ThreadFeedback {
Positive,
@@ -357,8 +354,8 @@ impl AcpThreadView {
agent.name(),
&placeholder,
editor::EditorMode::AutoHeight {
- min_lines: MIN_EDITOR_LINES,
- max_lines: Some(MAX_EDITOR_LINES),
+ min_lines: AgentSettings::get_global(cx).message_editor_min_lines,
+ max_lines: Some(AgentSettings::get_global(cx).set_message_editor_max_lines()),
},
window,
cx,
@@ -857,10 +854,11 @@ impl AcpThreadView {
cx,
)
} else {
+ let agent_settings = AgentSettings::get_global(cx);
editor.set_mode(
EditorMode::AutoHeight {
- min_lines: MIN_EDITOR_LINES,
- max_lines: Some(MAX_EDITOR_LINES),
+ min_lines: agent_settings.message_editor_min_lines,
+ max_lines: Some(agent_settings.set_message_editor_max_lines()),
},
cx,
)
diff --git a/docs/src/ai/agent-settings.md b/docs/src/ai/agent-settings.md
index d78f812e470..d13e7733878 100644
--- a/docs/src/ai/agent-settings.md
+++ b/docs/src/ai/agent-settings.md
@@ -170,6 +170,21 @@ The default value is `false`.
> This setting is available via the Agent Panel's settings UI.
+### Message Editor Size
+
+Use the `message_editor_min_lines` setting to control minimum number of lines of height the agent message editor should have.
+It is set to `4` by default, and the max number of lines is always double of the minimum.
+
+```json
+{
+ "agent": {
+ "message_editor_min_lines": 4
+ }
+}
+```
+
+> This setting is currently available only in Preview.
+
### Modifier to Send
Make a modifier (`cmd` on macOS, `ctrl` on Linux) required to send messages.