edit predictions: Add enabled_in_assistant
setting (#25767)
Release Notes: - edit predictions: Add `enabled_in_assistant` setting
This commit is contained in:
parent
6eb2ffe77a
commit
82f793144e
4 changed files with 48 additions and 3 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue