Add Codestral edit predictions provider (#34371)

Release Notes:

- Added Codestral edit predictions provider which can be enabled by adding an API key in the Mistral section of agent settings.

![2025-07-13 11 35
33](https://github.com/user-attachments/assets/8bf599d7-33c7-4556-b878-6c645d69661f)


## Config

Get API key from https://console.mistral.ai/codestral and add it in the Mistral section of the agent settings. 

```
  "features": {
    "edit_prediction_provider": "codestral"
  },
  "edit_predictions": {
    "codestral": {
      "model": "codestral-latest",
      "max_tokens": 150
    }
  },
```

---------

Co-authored-by: Michael Sloan <michael@zed.dev>
This commit is contained in:
David
2025-10-08 12:02:21 -06:00
committed by GitHub
co-authored by Michael Sloan
parent 096930817b
commit 5fd187769d
19 changed files with 918 additions and 124 deletions
+17
View File
@@ -377,6 +377,8 @@ pub struct EditPredictionSettings {
pub mode: settings::EditPredictionsMode,
/// Settings specific to GitHub Copilot.
pub copilot: CopilotSettings,
/// Settings specific to Codestral.
pub codestral: CodestralSettings,
/// Whether edit predictions are enabled in the assistant panel.
/// This setting has no effect if globally disabled.
pub enabled_in_text_threads: bool,
@@ -412,6 +414,14 @@ pub struct CopilotSettings {
pub enterprise_uri: Option<String>,
}
#[derive(Clone, Debug, Default)]
pub struct CodestralSettings {
/// Model to use for completions.
pub model: Option<String>,
/// Maximum tokens to generate.
pub max_tokens: Option<u32>,
}
impl AllLanguageSettings {
/// Returns the [`LanguageSettings`] for the language with the specified name.
pub fn language<'a>(
@@ -622,6 +632,12 @@ impl settings::Settings for AllLanguageSettings {
enterprise_uri: copilot.enterprise_uri,
};
let codestral = edit_predictions.codestral.unwrap();
let codestral_settings = CodestralSettings {
model: codestral.model,
max_tokens: codestral.max_tokens,
};
let enabled_in_text_threads = edit_predictions.enabled_in_text_threads.unwrap();
let mut file_types: FxHashMap<Arc<str>, GlobSet> = FxHashMap::default();
@@ -655,6 +671,7 @@ impl settings::Settings for AllLanguageSettings {
.collect(),
mode: edit_predictions_mode,
copilot: copilot_settings,
codestral: codestral_settings,
enabled_in_text_threads,
},
defaults: default_language_settings,