Update assistant
to agent
in settings and keymaps (#29943)
Closes #ISSUE Release Notes: - Agent Beta: Renamed the top-level `assistant` settings key to `agent`. A migration for existing settings files is included. - Agent Beta: Moved the `assistant::ToggleFocus`, `assistant::ToggleModelSelector`, and `assistant::OpenRulesLibrary` actions to the `agent` namespace. Existing keymaps that mention these actions by their old names will continue to work. --------- Co-authored-by: Max <max@zed.dev>
This commit is contained in:
parent
34e10e4e56
commit
bdd911f89e
17 changed files with 191 additions and 58 deletions
|
@ -220,9 +220,9 @@
|
||||||
"ctrl-shift-e": "project_panel::ToggleFocus",
|
"ctrl-shift-e": "project_panel::ToggleFocus",
|
||||||
"ctrl-g": "search::SelectNextMatch",
|
"ctrl-g": "search::SelectNextMatch",
|
||||||
"ctrl-shift-g": "search::SelectPreviousMatch",
|
"ctrl-shift-g": "search::SelectPreviousMatch",
|
||||||
"ctrl-alt-/": "assistant::ToggleModelSelector",
|
"ctrl-alt-/": "agent::ToggleModelSelector",
|
||||||
"ctrl-k h": "assistant::DeployHistory",
|
"ctrl-k h": "assistant::DeployHistory",
|
||||||
"ctrl-k l": "assistant::OpenRulesLibrary",
|
"ctrl-k l": "agent::OpenRulesLibrary",
|
||||||
"new": "assistant::NewChat",
|
"new": "assistant::NewChat",
|
||||||
"ctrl-t": "assistant::NewChat",
|
"ctrl-t": "assistant::NewChat",
|
||||||
"ctrl-n": "assistant::NewChat"
|
"ctrl-n": "assistant::NewChat"
|
||||||
|
@ -237,7 +237,7 @@
|
||||||
"save": "workspace::Save",
|
"save": "workspace::Save",
|
||||||
"ctrl->": "assistant::QuoteSelection",
|
"ctrl->": "assistant::QuoteSelection",
|
||||||
"ctrl-<": "assistant::InsertIntoEditor",
|
"ctrl-<": "assistant::InsertIntoEditor",
|
||||||
"ctrl-alt-/": "assistant::ToggleModelSelector",
|
"ctrl-alt-/": "agent::ToggleModelSelector",
|
||||||
"shift-enter": "assistant::Split",
|
"shift-enter": "assistant::Split",
|
||||||
"ctrl-r": "assistant::CycleMessageRole",
|
"ctrl-r": "assistant::CycleMessageRole",
|
||||||
"enter": "assistant::ConfirmCommand",
|
"enter": "assistant::ConfirmCommand",
|
||||||
|
@ -251,9 +251,9 @@
|
||||||
"ctrl-alt-n": "agent::NewTextThread",
|
"ctrl-alt-n": "agent::NewTextThread",
|
||||||
"ctrl-shift-h": "agent::OpenHistory",
|
"ctrl-shift-h": "agent::OpenHistory",
|
||||||
"ctrl-alt-c": "agent::OpenConfiguration",
|
"ctrl-alt-c": "agent::OpenConfiguration",
|
||||||
"ctrl-alt-p": "assistant::OpenRulesLibrary",
|
"ctrl-alt-p": "agent::OpenRulesLibrary",
|
||||||
"ctrl-i": "agent::ToggleProfileSelector",
|
"ctrl-i": "agent::ToggleProfileSelector",
|
||||||
"ctrl-alt-/": "assistant::ToggleModelSelector",
|
"ctrl-alt-/": "agent::ToggleModelSelector",
|
||||||
"ctrl-shift-a": "agent::ToggleContextPicker",
|
"ctrl-shift-a": "agent::ToggleContextPicker",
|
||||||
"ctrl-shift-o": "agent::ToggleNavigationMenu",
|
"ctrl-shift-o": "agent::ToggleNavigationMenu",
|
||||||
"ctrl-shift-i": "agent::ToggleOptionsMenu",
|
"ctrl-shift-i": "agent::ToggleOptionsMenu",
|
||||||
|
@ -568,7 +568,7 @@
|
||||||
"ctrl-shift-e": "project_panel::ToggleFocus",
|
"ctrl-shift-e": "project_panel::ToggleFocus",
|
||||||
"ctrl-shift-b": "outline_panel::ToggleFocus",
|
"ctrl-shift-b": "outline_panel::ToggleFocus",
|
||||||
"ctrl-shift-g": "git_panel::ToggleFocus",
|
"ctrl-shift-g": "git_panel::ToggleFocus",
|
||||||
"ctrl-?": "assistant::ToggleFocus",
|
"ctrl-?": "agent::ToggleFocus",
|
||||||
"alt-save": "workspace::SaveAll",
|
"alt-save": "workspace::SaveAll",
|
||||||
"ctrl-alt-s": "workspace::SaveAll",
|
"ctrl-alt-s": "workspace::SaveAll",
|
||||||
"ctrl-k m": "language_selector::Toggle",
|
"ctrl-k m": "language_selector::Toggle",
|
||||||
|
|
|
@ -266,9 +266,9 @@
|
||||||
"cmd-shift-e": "project_panel::ToggleFocus",
|
"cmd-shift-e": "project_panel::ToggleFocus",
|
||||||
"cmd-g": "search::SelectNextMatch",
|
"cmd-g": "search::SelectNextMatch",
|
||||||
"cmd-shift-g": "search::SelectPreviousMatch",
|
"cmd-shift-g": "search::SelectPreviousMatch",
|
||||||
"cmd-alt-/": "assistant::ToggleModelSelector",
|
"cmd-alt-/": "agent::ToggleModelSelector",
|
||||||
"cmd-k h": "assistant::DeployHistory",
|
"cmd-k h": "assistant::DeployHistory",
|
||||||
"cmd-k l": "assistant::OpenRulesLibrary",
|
"cmd-k l": "agent::OpenRulesLibrary",
|
||||||
"cmd-t": "assistant::NewChat",
|
"cmd-t": "assistant::NewChat",
|
||||||
"cmd-n": "assistant::NewChat"
|
"cmd-n": "assistant::NewChat"
|
||||||
}
|
}
|
||||||
|
@ -282,11 +282,14 @@
|
||||||
"cmd-s": "workspace::Save",
|
"cmd-s": "workspace::Save",
|
||||||
"cmd->": "assistant::QuoteSelection",
|
"cmd->": "assistant::QuoteSelection",
|
||||||
"cmd-<": "assistant::InsertIntoEditor",
|
"cmd-<": "assistant::InsertIntoEditor",
|
||||||
"cmd-alt-/": "assistant::ToggleModelSelector",
|
|
||||||
"shift-enter": "assistant::Split",
|
"shift-enter": "assistant::Split",
|
||||||
"ctrl-r": "assistant::CycleMessageRole",
|
"ctrl-r": "assistant::CycleMessageRole",
|
||||||
"enter": "assistant::ConfirmCommand",
|
"enter": "assistant::ConfirmCommand",
|
||||||
"alt-enter": "editor::Newline"
|
"alt-enter": "editor::Newline",
|
||||||
|
"cmd-k c": "assistant::CopyCode",
|
||||||
|
"cmd-g": "search::SelectNextMatch",
|
||||||
|
"cmd-shift-g": "search::SelectPreviousMatch",
|
||||||
|
"cmd-k l": "agent::OpenRulesLibrary"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -297,14 +300,15 @@
|
||||||
"cmd-alt-n": "agent::NewTextThread",
|
"cmd-alt-n": "agent::NewTextThread",
|
||||||
"cmd-shift-h": "agent::OpenHistory",
|
"cmd-shift-h": "agent::OpenHistory",
|
||||||
"cmd-alt-c": "agent::OpenConfiguration",
|
"cmd-alt-c": "agent::OpenConfiguration",
|
||||||
"cmd-alt-p": "assistant::OpenRulesLibrary",
|
"cmd-alt-p": "agent::OpenRulesLibrary",
|
||||||
"cmd-i": "agent::ToggleProfileSelector",
|
"cmd-i": "agent::ToggleProfileSelector",
|
||||||
"cmd-alt-/": "assistant::ToggleModelSelector",
|
"cmd-alt-/": "agent::ToggleModelSelector",
|
||||||
"cmd-shift-a": "agent::ToggleContextPicker",
|
"cmd-shift-a": "agent::ToggleContextPicker",
|
||||||
"cmd-shift-o": "agent::ToggleNavigationMenu",
|
"cmd-shift-o": "agent::ToggleNavigationMenu",
|
||||||
"cmd-shift-i": "agent::ToggleOptionsMenu",
|
"cmd-shift-i": "agent::ToggleOptionsMenu",
|
||||||
"shift-escape": "agent::ExpandMessageEditor",
|
"shift-escape": "agent::ExpandMessageEditor",
|
||||||
"cmd-alt-e": "agent::RemoveAllContext"
|
"cmd-alt-e": "agent::RemoveAllContext",
|
||||||
|
"cmd-shift-e": "project_panel::ToggleFocus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -635,7 +639,7 @@
|
||||||
"cmd-shift-e": "project_panel::ToggleFocus",
|
"cmd-shift-e": "project_panel::ToggleFocus",
|
||||||
"cmd-shift-b": "outline_panel::ToggleFocus",
|
"cmd-shift-b": "outline_panel::ToggleFocus",
|
||||||
"ctrl-shift-g": "git_panel::ToggleFocus",
|
"ctrl-shift-g": "git_panel::ToggleFocus",
|
||||||
"cmd-?": "assistant::ToggleFocus",
|
"cmd-?": "agent::ToggleFocus",
|
||||||
"cmd-alt-s": "workspace::SaveAll",
|
"cmd-alt-s": "workspace::SaveAll",
|
||||||
"cmd-k m": "language_selector::Toggle",
|
"cmd-k m": "language_selector::Toggle",
|
||||||
"escape": "workspace::Unfollow",
|
"escape": "workspace::Unfollow",
|
||||||
|
@ -774,7 +778,7 @@
|
||||||
"use_key_equivalents": true,
|
"use_key_equivalents": true,
|
||||||
"bindings": {
|
"bindings": {
|
||||||
"cmd-shift-a": "agent::ToggleContextPicker",
|
"cmd-shift-a": "agent::ToggleContextPicker",
|
||||||
"cmd-alt-/": "assistant::ToggleModelSelector",
|
"cmd-alt-/": "agent::ToggleModelSelector",
|
||||||
"cmd-alt-e": "agent::RemoveAllContext",
|
"cmd-alt-e": "agent::RemoveAllContext",
|
||||||
"ctrl-[": "assistant::CyclePreviousInlineAssist",
|
"ctrl-[": "assistant::CyclePreviousInlineAssist",
|
||||||
"ctrl-]": "assistant::CycleNextInlineAssist"
|
"ctrl-]": "assistant::CycleNextInlineAssist"
|
||||||
|
|
|
@ -632,27 +632,27 @@
|
||||||
// Default width of the notification panel.
|
// Default width of the notification panel.
|
||||||
"default_width": 380
|
"default_width": 380
|
||||||
},
|
},
|
||||||
"assistant": {
|
"agent": {
|
||||||
// Version of this setting.
|
// Version of this setting.
|
||||||
"version": "2",
|
"version": "2",
|
||||||
// Whether the assistant is enabled.
|
// Whether the agent is enabled.
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
// Whether to show the assistant panel button in the status bar.
|
// Whether to show the agent panel button in the status bar.
|
||||||
"button": true,
|
"button": true,
|
||||||
// Where to dock the assistant panel. Can be 'left', 'right' or 'bottom'.
|
// Where to dock the agent panel. Can be 'left', 'right' or 'bottom'.
|
||||||
"dock": "right",
|
"dock": "right",
|
||||||
// Default width when the assistant is docked to the left or right.
|
// Default width when the agent panel is docked to the left or right.
|
||||||
"default_width": 640,
|
"default_width": 640,
|
||||||
// Default height when the assistant is docked to the bottom.
|
// Default height when the agent panel is docked to the bottom.
|
||||||
"default_height": 320,
|
"default_height": 320,
|
||||||
// The default model to use when creating new chats.
|
// The default model to use when creating new threads.
|
||||||
"default_model": {
|
"default_model": {
|
||||||
// The provider to use.
|
// The provider to use.
|
||||||
"provider": "zed.dev",
|
"provider": "zed.dev",
|
||||||
// The model to use.
|
// The model to use.
|
||||||
"model": "claude-3-7-sonnet-latest"
|
"model": "claude-3-7-sonnet-latest"
|
||||||
},
|
},
|
||||||
// The model to use when applying edits from the assistant.
|
// The model to use when applying edits from the agent.
|
||||||
"editor_model": {
|
"editor_model": {
|
||||||
// The provider to use.
|
// The provider to use.
|
||||||
"provider": "zed.dev",
|
"provider": "zed.dev",
|
||||||
|
@ -713,7 +713,7 @@
|
||||||
"tools": {}
|
"tools": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Where to show notifications when an agent has either completed
|
// Where to show notifications when the agent has either completed
|
||||||
// its response, or else needs confirmation before it can run a
|
// its response, or else needs confirmation before it can run a
|
||||||
// tool action.
|
// tool action.
|
||||||
// "primary_screen" - Show the notification only on your primary screen (default)
|
// "primary_screen" - Show the notification only on your primary screen (default)
|
||||||
|
@ -1018,9 +1018,9 @@
|
||||||
// 2. Display predictions inline only when holding a modifier key (alt by default).
|
// 2. Display predictions inline only when holding a modifier key (alt by default).
|
||||||
// "mode": "subtle"
|
// "mode": "subtle"
|
||||||
"mode": "eager",
|
"mode": "eager",
|
||||||
// Whether edit predictions are enabled in the assistant panel.
|
// Whether edit predictions are enabled when editing text threads.
|
||||||
// This setting has no effect if globally disabled.
|
// This setting has no effect if globally disabled.
|
||||||
"enabled_in_assistant": true
|
"enabled_in_text_threads": true
|
||||||
},
|
},
|
||||||
// Settings specific to journaling
|
// Settings specific to journaling
|
||||||
"journal": {
|
"journal": {
|
||||||
|
@ -1614,7 +1614,7 @@
|
||||||
// }
|
// }
|
||||||
// ]
|
// ]
|
||||||
"ssh_connections": [],
|
"ssh_connections": [],
|
||||||
// Configures context servers for use in the Assistant.
|
// Configures context servers for use by the agent.
|
||||||
"context_servers": {},
|
"context_servers": {},
|
||||||
"debugger": {
|
"debugger": {
|
||||||
"stepping_granularity": "line",
|
"stepping_granularity": "line",
|
||||||
|
|
|
@ -219,7 +219,7 @@ impl AgentDiffPane {
|
||||||
.thread
|
.thread
|
||||||
.read(cx)
|
.read(cx)
|
||||||
.summary()
|
.summary()
|
||||||
.unwrap_or("Assistant Changes".into());
|
.unwrap_or("Agent Changes".into());
|
||||||
if new_title != self.title {
|
if new_title != self.title {
|
||||||
self.title = new_title;
|
self.title = new_title;
|
||||||
cx.emit(EditorEvent::TitleChanged);
|
cx.emit(EditorEvent::TitleChanged);
|
||||||
|
@ -473,7 +473,7 @@ impl Item for AgentDiffPane {
|
||||||
.thread
|
.thread
|
||||||
.read(cx)
|
.read(cx)
|
||||||
.summary()
|
.summary()
|
||||||
.unwrap_or("Assistant Changes".into());
|
.unwrap_or("Agent Changes".into());
|
||||||
Label::new(format!("Review: {}", summary))
|
Label::new(format!("Review: {}", summary))
|
||||||
.color(if params.selected {
|
.color(if params.selected {
|
||||||
Color::Default
|
Color::Default
|
||||||
|
|
|
@ -772,7 +772,7 @@ impl CodegenAlternative {
|
||||||
cx: &mut Context<CodegenAlternative>,
|
cx: &mut Context<CodegenAlternative>,
|
||||||
) {
|
) {
|
||||||
let transaction = self.buffer.update(cx, |buffer, cx| {
|
let transaction = self.buffer.update(cx, |buffer, cx| {
|
||||||
// Avoid grouping assistant edits with user edits.
|
// Avoid grouping agent edits with user edits.
|
||||||
buffer.finalize_last_transaction(cx);
|
buffer.finalize_last_transaction(cx);
|
||||||
buffer.start_transaction(cx);
|
buffer.start_transaction(cx);
|
||||||
buffer.edit(edits, None, cx);
|
buffer.edit(edits, None, cx);
|
||||||
|
@ -781,7 +781,7 @@ impl CodegenAlternative {
|
||||||
|
|
||||||
if let Some(transaction) = transaction {
|
if let Some(transaction) = transaction {
|
||||||
if let Some(first_transaction) = self.transformation_transaction_id {
|
if let Some(first_transaction) = self.transformation_transaction_id {
|
||||||
// Group all assistant edits into the first transaction.
|
// Group all agent edits into the first transaction.
|
||||||
self.buffer.update(cx, |buffer, cx| {
|
self.buffer.update(cx, |buffer, cx| {
|
||||||
buffer.merge_transactions(transaction, first_transaction, cx)
|
buffer.merge_transactions(transaction, first_transaction, cx)
|
||||||
});
|
});
|
||||||
|
|
|
@ -998,7 +998,7 @@ impl Thread {
|
||||||
for message in &self.messages {
|
for message in &self.messages {
|
||||||
text.push_str(match message.role {
|
text.push_str(match message.role {
|
||||||
language_model::Role::User => "User:",
|
language_model::Role::User => "User:",
|
||||||
language_model::Role::Assistant => "Assistant:",
|
language_model::Role::Assistant => "Agent:",
|
||||||
language_model::Role::System => "System:",
|
language_model::Role::System => "System:",
|
||||||
});
|
});
|
||||||
text.push('\n');
|
text.push('\n');
|
||||||
|
@ -2360,7 +2360,7 @@ impl Thread {
|
||||||
"## {role}\n",
|
"## {role}\n",
|
||||||
role = match message.role {
|
role = match message.role {
|
||||||
Role::User => "User",
|
Role::User => "User",
|
||||||
Role::Assistant => "Assistant",
|
Role::Assistant => "Agent",
|
||||||
Role::System => "System",
|
Role::System => "System",
|
||||||
}
|
}
|
||||||
)?;
|
)?;
|
||||||
|
|
|
@ -258,7 +258,7 @@ impl ContextEditor {
|
||||||
|
|
||||||
let show_edit_predictions = all_language_settings(None, cx)
|
let show_edit_predictions = all_language_settings(None, cx)
|
||||||
.edit_predictions
|
.edit_predictions
|
||||||
.enabled_in_assistant;
|
.enabled_in_text_threads;
|
||||||
|
|
||||||
editor.set_show_edit_predictions(Some(show_edit_predictions), window, cx);
|
editor.set_show_edit_predictions(Some(show_edit_predictions), window, cx);
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ impl ContextEditor {
|
||||||
self.editor.update(cx, |editor, cx| {
|
self.editor.update(cx, |editor, cx| {
|
||||||
let show_edit_predictions = all_language_settings(None, cx)
|
let show_edit_predictions = all_language_settings(None, cx)
|
||||||
.edit_predictions
|
.edit_predictions
|
||||||
.enabled_in_assistant;
|
.enabled_in_text_threads;
|
||||||
|
|
||||||
editor.set_show_edit_predictions(Some(show_edit_predictions), window, cx);
|
editor.set_show_edit_predictions(Some(show_edit_predictions), window, cx);
|
||||||
});
|
});
|
||||||
|
@ -1406,7 +1406,7 @@ impl ContextEditor {
|
||||||
None,
|
None,
|
||||||
),
|
),
|
||||||
Role::Assistant => {
|
Role::Assistant => {
|
||||||
let base_label = Label::new("Assistant").color(Color::Info);
|
let base_label = Label::new("Agent").color(Color::Info);
|
||||||
let mut spinner = None;
|
let mut spinner = None;
|
||||||
let mut note = None;
|
let mut note = None;
|
||||||
let animated_label = if llm_loading {
|
let animated_label = if llm_loading {
|
||||||
|
@ -1468,7 +1468,7 @@ impl ContextEditor {
|
||||||
Tooltip::with_meta(
|
Tooltip::with_meta(
|
||||||
"Toggle message role",
|
"Toggle message role",
|
||||||
None,
|
None,
|
||||||
"Available roles: You (User), Assistant, System",
|
"Available roles: You (User), Agent, System",
|
||||||
window,
|
window,
|
||||||
cx,
|
cx,
|
||||||
)
|
)
|
||||||
|
|
|
@ -693,7 +693,7 @@ pub struct LegacyAssistantSettingsContent {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Settings for AssistantSettings {
|
impl Settings for AssistantSettings {
|
||||||
const KEY: Option<&'static str> = Some("assistant");
|
const KEY: Option<&'static str> = Some("agent");
|
||||||
|
|
||||||
const PRESERVED_KEYS: Option<&'static [&'static str]> = Some(&["version"]);
|
const PRESERVED_KEYS: Option<&'static [&'static str]> = Some(&["version"]);
|
||||||
|
|
||||||
|
@ -894,12 +894,12 @@ mod tests {
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
struct AssistantSettingsTest {
|
struct AssistantSettingsTest {
|
||||||
assistant: AssistantSettingsContent,
|
agent: AssistantSettingsContent,
|
||||||
}
|
}
|
||||||
|
|
||||||
let assistant_settings: AssistantSettingsTest =
|
let assistant_settings: AssistantSettingsTest =
|
||||||
serde_json_lenient::from_str(&raw_settings_value).unwrap();
|
serde_json_lenient::from_str(&raw_settings_value).unwrap();
|
||||||
|
|
||||||
assert!(!assistant_settings.assistant.is_version_outdated());
|
assert!(!assistant_settings.agent.is_version_outdated());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,7 +242,7 @@ pub struct EditPredictionSettings {
|
||||||
pub copilot: CopilotSettings,
|
pub copilot: CopilotSettings,
|
||||||
/// Whether edit predictions are enabled in the assistant panel.
|
/// Whether edit predictions are enabled in the assistant panel.
|
||||||
/// This setting has no effect if globally disabled.
|
/// This setting has no effect if globally disabled.
|
||||||
pub enabled_in_assistant: bool,
|
pub enabled_in_text_threads: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EditPredictionSettings {
|
impl EditPredictionSettings {
|
||||||
|
@ -584,7 +584,7 @@ pub struct EditPredictionSettingsContent {
|
||||||
/// Whether edit predictions are enabled in the assistant prompt editor.
|
/// Whether edit predictions are enabled in the assistant prompt editor.
|
||||||
/// This has no effect if globally disabled.
|
/// This has no effect if globally disabled.
|
||||||
#[serde(default = "default_true")]
|
#[serde(default = "default_true")]
|
||||||
pub enabled_in_assistant: bool,
|
pub enabled_in_text_threads: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq)]
|
#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq)]
|
||||||
|
@ -1216,10 +1216,10 @@ impl settings::Settings for AllLanguageSettings {
|
||||||
})
|
})
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
let mut edit_predictions_enabled_in_assistant = default_value
|
let mut enabled_in_text_threads = default_value
|
||||||
.edit_predictions
|
.edit_predictions
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|settings| settings.enabled_in_assistant)
|
.map(|settings| settings.enabled_in_text_threads)
|
||||||
.unwrap_or(true);
|
.unwrap_or(true);
|
||||||
|
|
||||||
let mut file_types: FxHashMap<Arc<str>, GlobSet> = FxHashMap::default();
|
let mut file_types: FxHashMap<Arc<str>, GlobSet> = FxHashMap::default();
|
||||||
|
@ -1245,7 +1245,7 @@ impl settings::Settings for AllLanguageSettings {
|
||||||
|
|
||||||
if let Some(edit_predictions) = user_settings.edit_predictions.as_ref() {
|
if let Some(edit_predictions) = user_settings.edit_predictions.as_ref() {
|
||||||
edit_predictions_mode = edit_predictions.mode;
|
edit_predictions_mode = edit_predictions.mode;
|
||||||
edit_predictions_enabled_in_assistant = edit_predictions.enabled_in_assistant;
|
enabled_in_text_threads = edit_predictions.enabled_in_text_threads;
|
||||||
|
|
||||||
if let Some(disabled_globs) = edit_predictions.disabled_globs.as_ref() {
|
if let Some(disabled_globs) = edit_predictions.disabled_globs.as_ref() {
|
||||||
completion_globs.extend(disabled_globs.iter());
|
completion_globs.extend(disabled_globs.iter());
|
||||||
|
@ -1323,7 +1323,7 @@ impl settings::Settings for AllLanguageSettings {
|
||||||
.collect(),
|
.collect(),
|
||||||
mode: edit_predictions_mode,
|
mode: edit_predictions_mode,
|
||||||
copilot: copilot_settings,
|
copilot: copilot_settings,
|
||||||
enabled_in_assistant: edit_predictions_enabled_in_assistant,
|
enabled_in_text_threads,
|
||||||
},
|
},
|
||||||
defaults,
|
defaults,
|
||||||
languages,
|
languages,
|
||||||
|
|
|
@ -15,9 +15,12 @@ use proto::Plan;
|
||||||
use ui::{ListItem, ListItemSpacing, PopoverMenu, PopoverMenuHandle, PopoverTrigger, prelude::*};
|
use ui::{ListItem, ListItemSpacing, PopoverMenu, PopoverMenuHandle, PopoverTrigger, prelude::*};
|
||||||
|
|
||||||
action_with_deprecated_aliases!(
|
action_with_deprecated_aliases!(
|
||||||
assistant,
|
agent,
|
||||||
ToggleModelSelector,
|
ToggleModelSelector,
|
||||||
["assistant2::ToggleModelSelector"]
|
[
|
||||||
|
"assistant::ToggleModelSelector",
|
||||||
|
"assistant2::ToggleModelSelector"
|
||||||
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
const TRY_ZED_PRO_URL: &str = "https://zed.dev/pro";
|
const TRY_ZED_PRO_URL: &str = "https://zed.dev/pro";
|
||||||
|
|
|
@ -57,3 +57,9 @@ pub(crate) mod m_2025_04_23 {
|
||||||
|
|
||||||
pub(crate) use settings::SETTINGS_PATTERNS;
|
pub(crate) use settings::SETTINGS_PATTERNS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) mod m_2025_05_05 {
|
||||||
|
mod settings;
|
||||||
|
|
||||||
|
pub(crate) use settings::SETTINGS_PATTERNS;
|
||||||
|
}
|
||||||
|
|
41
crates/migrator/src/migrations/m_2025_05_05/settings.rs
Normal file
41
crates/migrator/src/migrations/m_2025_05_05/settings.rs
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
use std::ops::Range;
|
||||||
|
use tree_sitter::{Query, QueryMatch};
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
MigrationPatterns, patterns::SETTINGS_ASSISTANT_PATTERN,
|
||||||
|
patterns::SETTINGS_EDIT_PREDICTIONS_ASSISTANT_PATTERN,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub const SETTINGS_PATTERNS: MigrationPatterns = &[
|
||||||
|
(SETTINGS_ASSISTANT_PATTERN, rename_assistant),
|
||||||
|
(
|
||||||
|
SETTINGS_EDIT_PREDICTIONS_ASSISTANT_PATTERN,
|
||||||
|
rename_edit_prediction_assistant,
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
|
fn rename_assistant(
|
||||||
|
_contents: &str,
|
||||||
|
mat: &QueryMatch,
|
||||||
|
query: &Query,
|
||||||
|
) -> Option<(Range<usize>, String)> {
|
||||||
|
let key_capture_ix = query.capture_index_for_name("key")?;
|
||||||
|
let key_range = mat
|
||||||
|
.nodes_for_capture_index(key_capture_ix)
|
||||||
|
.next()?
|
||||||
|
.byte_range();
|
||||||
|
return Some((key_range, "agent".to_string()));
|
||||||
|
}
|
||||||
|
|
||||||
|
fn rename_edit_prediction_assistant(
|
||||||
|
_contents: &str,
|
||||||
|
mat: &QueryMatch,
|
||||||
|
query: &Query,
|
||||||
|
) -> Option<(Range<usize>, String)> {
|
||||||
|
let key_capture_ix = query.capture_index_for_name("enabled_in_assistant")?;
|
||||||
|
let key_range = mat
|
||||||
|
.nodes_for_capture_index(key_capture_ix)
|
||||||
|
.next()?
|
||||||
|
.byte_range();
|
||||||
|
return Some((key_range, "enabled_in_text_threads".to_string()));
|
||||||
|
}
|
|
@ -136,6 +136,10 @@ pub fn migrate_settings(text: &str) -> Result<Option<String>> {
|
||||||
migrations::m_2025_04_23::SETTINGS_PATTERNS,
|
migrations::m_2025_04_23::SETTINGS_PATTERNS,
|
||||||
&SETTINGS_QUERY_2025_04_23,
|
&SETTINGS_QUERY_2025_04_23,
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
migrations::m_2025_05_05::SETTINGS_PATTERNS,
|
||||||
|
&SETTINGS_QUERY_2025_05_05,
|
||||||
|
),
|
||||||
];
|
];
|
||||||
run_migrations(text, migrations)
|
run_migrations(text, migrations)
|
||||||
}
|
}
|
||||||
|
@ -222,6 +226,10 @@ define_query!(
|
||||||
SETTINGS_QUERY_2025_04_23,
|
SETTINGS_QUERY_2025_04_23,
|
||||||
migrations::m_2025_04_23::SETTINGS_PATTERNS
|
migrations::m_2025_04_23::SETTINGS_PATTERNS
|
||||||
);
|
);
|
||||||
|
define_query!(
|
||||||
|
SETTINGS_QUERY_2025_05_05,
|
||||||
|
migrations::m_2025_05_05::SETTINGS_PATTERNS
|
||||||
|
);
|
||||||
|
|
||||||
// custom query
|
// custom query
|
||||||
static EDIT_PREDICTION_SETTINGS_MIGRATION_QUERY: LazyLock<Query> = LazyLock::new(|| {
|
static EDIT_PREDICTION_SETTINGS_MIGRATION_QUERY: LazyLock<Query> = LazyLock::new(|| {
|
||||||
|
@ -581,7 +589,7 @@ mod tests {
|
||||||
Some(
|
Some(
|
||||||
r#"
|
r#"
|
||||||
{
|
{
|
||||||
"assistant": {
|
"agent": {
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"custom": {
|
"custom": {
|
||||||
"name": "Custom",
|
"name": "Custom",
|
||||||
|
@ -619,7 +627,7 @@ mod tests {
|
||||||
Some(
|
Some(
|
||||||
r#"
|
r#"
|
||||||
{
|
{
|
||||||
"assistant": {
|
"agent": {
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"custom": {
|
"custom": {
|
||||||
"name": "Custom",
|
"name": "Custom",
|
||||||
|
@ -655,7 +663,24 @@ mod tests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
None,
|
Some(
|
||||||
|
r#"
|
||||||
|
{
|
||||||
|
"agent": {
|
||||||
|
"profiles": {
|
||||||
|
"custom": {
|
||||||
|
"name": "Custom",
|
||||||
|
"tools": {
|
||||||
|
"diagnostics": true,
|
||||||
|
"find_path": true,
|
||||||
|
"read_file": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -679,7 +704,7 @@ mod tests {
|
||||||
Some(
|
Some(
|
||||||
r#"
|
r#"
|
||||||
{
|
{
|
||||||
"assistant": {
|
"agent": {
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"default": {
|
"default": {
|
||||||
"tools": {
|
"tools": {
|
||||||
|
@ -694,4 +719,28 @@ mod tests {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_rename_assistant() {
|
||||||
|
assert_migrate_settings(
|
||||||
|
r#"{
|
||||||
|
"assistant": {
|
||||||
|
"foo": "bar"
|
||||||
|
},
|
||||||
|
"edit_predictions": {
|
||||||
|
"enabled_in_assistant": false,
|
||||||
|
}
|
||||||
|
}"#,
|
||||||
|
Some(
|
||||||
|
r#"{
|
||||||
|
"agent": {
|
||||||
|
"foo": "bar"
|
||||||
|
},
|
||||||
|
"edit_predictions": {
|
||||||
|
"enabled_in_text_threads": false,
|
||||||
|
}
|
||||||
|
}"#,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ pub(crate) use keymap::{
|
||||||
};
|
};
|
||||||
|
|
||||||
pub(crate) use settings::{
|
pub(crate) use settings::{
|
||||||
SETTINGS_ASSISTANT_TOOLS_PATTERN, SETTINGS_LANGUAGES_PATTERN,
|
SETTINGS_ASSISTANT_PATTERN, SETTINGS_ASSISTANT_TOOLS_PATTERN,
|
||||||
|
SETTINGS_EDIT_PREDICTIONS_ASSISTANT_PATTERN, SETTINGS_LANGUAGES_PATTERN,
|
||||||
SETTINGS_NESTED_KEY_VALUE_PATTERN, SETTINGS_ROOT_KEY_VALUE_PATTERN,
|
SETTINGS_NESTED_KEY_VALUE_PATTERN, SETTINGS_ROOT_KEY_VALUE_PATTERN,
|
||||||
};
|
};
|
||||||
|
|
|
@ -71,3 +71,25 @@ pub const SETTINGS_ASSISTANT_TOOLS_PATTERN: &str = r#"(document
|
||||||
(#eq? @profiles "profiles")
|
(#eq? @profiles "profiles")
|
||||||
(#eq? @tools_key "tools")
|
(#eq? @tools_key "tools")
|
||||||
)"#;
|
)"#;
|
||||||
|
|
||||||
|
pub const SETTINGS_ASSISTANT_PATTERN: &str = r#"(document
|
||||||
|
(object
|
||||||
|
(pair
|
||||||
|
key: (string (string_content) @key)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(#eq? @key "assistant")
|
||||||
|
)"#;
|
||||||
|
|
||||||
|
pub const SETTINGS_EDIT_PREDICTIONS_ASSISTANT_PATTERN: &str = r#"(document
|
||||||
|
(object
|
||||||
|
(pair
|
||||||
|
key: (string (string_content) @edit_predictions)
|
||||||
|
value: (object
|
||||||
|
(pair key: (string (string_content) @enabled_in_assistant))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(#eq? @edit_predictions "edit_predictions")
|
||||||
|
(#eq? @enabled_in_assistant "enabled_in_assistant")
|
||||||
|
)"#;
|
||||||
|
|
|
@ -876,7 +876,7 @@ fn generate_commands(_: &App) -> Vec<VimCommand> {
|
||||||
VimCommand::str(("C", "ollab"), "collab_panel::ToggleFocus"),
|
VimCommand::str(("C", "ollab"), "collab_panel::ToggleFocus"),
|
||||||
VimCommand::str(("Ch", "at"), "chat_panel::ToggleFocus"),
|
VimCommand::str(("Ch", "at"), "chat_panel::ToggleFocus"),
|
||||||
VimCommand::str(("No", "tifications"), "notification_panel::ToggleFocus"),
|
VimCommand::str(("No", "tifications"), "notification_panel::ToggleFocus"),
|
||||||
VimCommand::str(("A", "I"), "assistant::ToggleFocus"),
|
VimCommand::str(("A", "I"), "agent::ToggleFocus"),
|
||||||
VimCommand::str(("G", "it"), "git_panel::ToggleFocus"),
|
VimCommand::str(("G", "it"), "git_panel::ToggleFocus"),
|
||||||
VimCommand::new(("noh", "lsearch"), search::buffer_search::Dismiss),
|
VimCommand::new(("noh", "lsearch"), search::buffer_search::Dismiss),
|
||||||
VimCommand::new(("$", ""), EndOfDocument),
|
VimCommand::new(("$", ""), EndOfDocument),
|
||||||
|
|
|
@ -190,12 +190,16 @@ pub mod agent {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod assistant {
|
pub mod assistant {
|
||||||
use gpui::{actions, impl_action_with_deprecated_aliases, impl_actions};
|
use gpui::{
|
||||||
|
action_with_deprecated_aliases, actions, impl_action_with_deprecated_aliases, impl_actions,
|
||||||
|
};
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
actions!(assistant, [ToggleFocus, ShowConfiguration]);
|
action_with_deprecated_aliases!(agent, ToggleFocus, ["assistant::ToggleFocus"]);
|
||||||
|
|
||||||
|
actions!(assistant, [ShowConfiguration]);
|
||||||
|
|
||||||
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema)]
|
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
|
@ -205,9 +209,12 @@ pub mod assistant {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_action_with_deprecated_aliases!(
|
impl_action_with_deprecated_aliases!(
|
||||||
assistant,
|
agent,
|
||||||
OpenRulesLibrary,
|
OpenRulesLibrary,
|
||||||
["assistant::DeployPromptLibrary"]
|
[
|
||||||
|
"assistant::OpenRulesLibrary",
|
||||||
|
"assistant::DeployPromptLibrary"
|
||||||
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
#[derive(Clone, Default, Deserialize, PartialEq, JsonSchema)]
|
#[derive(Clone, Default, Deserialize, PartialEq, JsonSchema)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue