edit predictions: Add enabled_in_assistant setting (#25767)

Release Notes:

- edit predictions: Add `enabled_in_assistant` setting
This commit is contained in:
Agus Zubiaga 2025-02-27 15:52:45 -03:00 committed by GitHub
parent 6eb2ffe77a
commit 82f793144e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 48 additions and 3 deletions

View file

@ -236,6 +236,9 @@ pub struct EditPredictionSettings {
pub mode: EditPredictionsMode,
/// Settings specific to GitHub Copilot.
pub copilot: CopilotSettings,
/// Whether edit predictions are enabled in the assistant prompt editor.
/// This setting has no effect if globally disabled.
pub enabled_in_assistant: bool,
}
impl EditPredictionSettings {
@ -500,6 +503,10 @@ pub struct EditPredictionSettingsContent {
/// Settings specific to GitHub Copilot.
#[serde(default)]
pub copilot: CopilotSettingsContent,
/// Whether edit predictions are enabled in the assistant prompt editor.
/// This has no effect if globally disabled.
#[serde(default = "default_true")]
pub enabled_in_assistant: bool,
}
#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq)]
@ -1119,6 +1126,12 @@ impl settings::Settings for AllLanguageSettings {
})
.unwrap_or_default();
let mut edit_predictions_enabled_in_assistant = default_value
.edit_predictions
.as_ref()
.map(|settings| settings.enabled_in_assistant)
.unwrap_or(true);
let mut file_types: HashMap<Arc<str>, GlobSet> = HashMap::default();
for (language, suffixes) in &default_value.file_types {
@ -1145,6 +1158,7 @@ impl settings::Settings for AllLanguageSettings {
if let Some(edit_predictions) = user_settings.edit_predictions.as_ref() {
edit_predictions_mode = edit_predictions.mode;
edit_predictions_enabled_in_assistant = edit_predictions.enabled_in_assistant;
if let Some(disabled_globs) = edit_predictions.disabled_globs.as_ref() {
completion_globs.extend(disabled_globs.iter());
@ -1224,6 +1238,7 @@ impl settings::Settings for AllLanguageSettings {
.collect(),
mode: edit_predictions_mode,
copilot: copilot_settings,
enabled_in_assistant: edit_predictions_enabled_in_assistant,
},
defaults,
languages,