fix(settings): copy pretty mcp client config
This commit is contained in:
parent
b9d5639a3e
commit
68e7530417
|
|
@ -96,12 +96,19 @@ impl Default for McpServer {
|
|||
}
|
||||
|
||||
impl McpServer {
|
||||
pub fn client_config_text(self) -> String {
|
||||
pub fn client_config_display_text(self) -> String {
|
||||
format!(
|
||||
r#"{{ "type": "http", "url": "http://127.0.0.1:{}/mcp" }}"#,
|
||||
self.port
|
||||
)
|
||||
}
|
||||
|
||||
pub fn client_config_clipboard_text(self) -> String {
|
||||
format!(
|
||||
"{{\n \"type\": \"http\",\n \"url\": \"http://127.0.0.1:{}/mcp\"\n}}",
|
||||
self.port
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// Editable inputs on the settings modal that aren't tied to a `Node`
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ fn paint_client_config(
|
|||
theme.muted_foreground,
|
||||
1.5,
|
||||
);
|
||||
let config = settings.mcp_server.client_config_text();
|
||||
let config = settings.mcp_server.client_config_display_text();
|
||||
let config = ellipsize(
|
||||
cx,
|
||||
&config,
|
||||
|
|
|
|||
|
|
@ -464,7 +464,7 @@ fn copy_mcp_client_config_queues_clipboard_text() {
|
|||
|
||||
assert_eq!(
|
||||
host.editor_state().chat.pending_copy_text.as_deref(),
|
||||
Some(r#"{ "type": "http", "url": "http://127.0.0.1:4123/mcp" }"#)
|
||||
Some("{\n \"type\": \"http\",\n \"url\": \"http://127.0.0.1:4123/mcp\"\n}")
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ impl WidgetHostNative {
|
|||
.editor_ui
|
||||
.agent_settings
|
||||
.mcp_server
|
||||
.client_config_text();
|
||||
.client_config_clipboard_text();
|
||||
self.editor_state.chat.queue_copy_text(config);
|
||||
}
|
||||
AgentSettingsHit::ToggleImagesAdvanced => {
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ impl WidgetHost {
|
|||
.editor_ui
|
||||
.agent_settings
|
||||
.mcp_server
|
||||
.client_config_text();
|
||||
.client_config_clipboard_text();
|
||||
self.editor_state.chat.queue_copy_text(config);
|
||||
}
|
||||
AgentSettingsHit::ToggleImagesAdvanced => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue