Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/acp_thread/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ pub trait AgentSessionConfigOptions {
fn set_config_option(
&self,
config_id: acp::SessionConfigId,
value: acp::SessionConfigValueId,
value: acp::SessionConfigOptionValue,
cx: &mut App,
) -> Task<Result<Vec<acp::SessionConfigOption>>>;

Expand Down
370 changes: 326 additions & 44 deletions crates/agent_servers/src/acp.rs

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions crates/agent_servers/src/agent_servers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use acp_thread::AgentConnection;
use agent_client_protocol::schema::v1 as acp_schema;
use anyhow::Result;
use gpui::{App, AppContext, Entity, Task};
use settings::SettingsStore;
use settings::{AgentConfigOptionValue, SettingsStore};
use std::{any::Any, rc::Rc, sync::Arc};

#[cfg(any(test, feature = "test-support"))]
Expand Down Expand Up @@ -71,14 +71,14 @@ pub trait AgentServer: Send {
) {
}

fn default_config_option(&self, _config_id: &str, _cx: &App) -> Option<String> {
fn default_config_option(&self, _config_id: &str, _cx: &App) -> Option<AgentConfigOptionValue> {
None
}

fn set_default_config_option(
&self,
_config_id: &str,
_value_id: Option<&str>,
_value: Option<AgentConfigOptionValue>,
_fs: Arc<dyn Fs>,
_cx: &mut App,
) {
Expand Down
11 changes: 5 additions & 6 deletions crates/agent_servers/src/custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use project::{
Project,
agent_server_store::{AgentId, AllAgentServersSettings},
};
use settings::{SettingsStore, update_settings_file};
use settings::{AgentConfigOptionValue, SettingsStore, update_settings_file};
use std::{rc::Rc, sync::Arc};
use ui::IconName;

Expand Down Expand Up @@ -142,7 +142,7 @@ impl AgentServer for CustomAgentServer {
});
}

fn default_config_option(&self, config_id: &str, cx: &App) -> Option<String> {
fn default_config_option(&self, config_id: &str, cx: &App) -> Option<AgentConfigOptionValue> {
let settings = cx.read_global(|settings: &SettingsStore, _| {
settings
.get::<AllAgentServersSettings>(None)
Expand All @@ -152,19 +152,18 @@ impl AgentServer for CustomAgentServer {

settings
.as_ref()
.and_then(|s| s.default_config_option(config_id).map(|s| s.to_string()))
.and_then(|s| s.default_config_option(config_id).cloned())
}

fn set_default_config_option(
&self,
config_id: &str,
value_id: Option<&str>,
value: Option<AgentConfigOptionValue>,
fs: Arc<dyn Fs>,
cx: &mut App,
) {
let agent_id = self.agent_id();
let config_id = config_id.to_string();
let value_id = value_id.map(|s| s.to_string());
update_settings_file(fs, cx, move |settings, _cx| {
let settings = settings
.agent_servers
Expand All @@ -181,7 +180,7 @@ impl AgentServer for CustomAgentServer {
default_config_options,
..
} => {
if let Some(value) = value_id.clone() {
if let Some(value) = value {
default_config_options.insert(config_id.clone(), value);
} else {
default_config_options.remove(&config_id);
Expand Down
Loading
Loading