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.

context_servers: Make `settings` field show up in settings completions (#20905)

Marshall Bowers973498e07599
diff --git a/crates/context_servers/src/manager.rs b/crates/context_servers/src/manager.rs
index fc0c77e821b..9b9520e223b 100644
--- a/crates/context_servers/src/manager.rs
+++ b/crates/context_servers/src/manager.rs
@@ -24,6 +24,8 @@ use gpui::{AsyncAppContext, EventEmitter, Model, ModelContext, Subscription, Tas
use log;
use parking_lot::RwLock;
use project::Project;
+use schemars::gen::SchemaGenerator;
+use schemars::schema::{InstanceType, Schema, SchemaObject};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use settings::{Settings, SettingsSources, SettingsStore};
@@ -43,9 +45,17 @@ pub struct ContextServerSettings {
#[derive(Deserialize, Serialize, Clone, PartialEq, Eq, JsonSchema, Debug, Default)]
pub struct ServerConfig {
pub command: Option<ServerCommand>,
+ #[schemars(schema_with = "server_config_settings_json_schema")]
pub settings: Option<serde_json::Value>,
}
+fn server_config_settings_json_schema(_generator: &mut SchemaGenerator) -> Schema {
+ Schema::Object(SchemaObject {
+ instance_type: Some(InstanceType::Object.into()),
+ ..Default::default()
+ })
+}
+
#[derive(Deserialize, Serialize, Clone, PartialEq, Eq, JsonSchema, Debug)]
pub struct ServerCommand {
pub path: String,