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
@@ -82,6 +82,7 @@ pub enum EditPredictionProvider {
Copilot,
Supermaven,
Zed,
Codestral,
}
impl EditPredictionProvider {
@@ -90,7 +91,8 @@ impl EditPredictionProvider {
EditPredictionProvider::Zed => true,
EditPredictionProvider::None
| EditPredictionProvider::Copilot
| EditPredictionProvider::Supermaven => false,
| EditPredictionProvider::Supermaven
| EditPredictionProvider::Codestral => false,
}
}
}
@@ -108,6 +110,8 @@ pub struct EditPredictionSettingsContent {
pub mode: Option<EditPredictionsMode>,
/// Settings specific to GitHub Copilot.
pub copilot: Option<CopilotSettingsContent>,
/// Settings specific to Codestral.
pub codestral: Option<CodestralSettingsContent>,
/// Whether edit predictions are enabled in the assistant prompt editor.
/// This has no effect if globally disabled.
pub enabled_in_text_threads: Option<bool>,
@@ -130,6 +134,20 @@ pub struct CopilotSettingsContent {
pub enterprise_uri: Option<String>,
}
#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq)]
pub struct CodestralSettingsContent {
/// Model to use for completions.
///
/// Default: "codestral-latest"
#[serde(default)]
pub model: Option<String>,
/// Maximum tokens to generate.
///
/// Default: 150
#[serde(default)]
pub max_tokens: Option<u32>,
}
/// The mode in which edit predictions should be displayed.
#[derive(
Copy, Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, JsonSchema, MergeFrom,