copilot: Decouple copilot sign in from edit prediction settings (#26689)

Closes #25883

This PR allows you to use copilot chat for assistant without setting
copilot as the edit prediction provider.


[copilot.webm](https://github.com/user-attachments/assets/fecfbde1-d72c-4c0c-b080-a07671fb846e)

Todos:
- [x] Remove redudant "copilot" key from settings
- [x] Do not disable copilot LSP when `edit_prediction_provider` is not
set to `copilot`
- [x] Start copilot LSP when:
  - [x]  `edit_prediction_provider` is set to `copilot`
  - [x] Copilot sign in clicked from assistant settings
- [x] Handle flicker for frame after starting LSP, but before signing in
caused due to signed out status
- [x] Fixed this by adding intermediate state for awaiting signing in in
sign out enum
- [x] Handle cancel button should sign out from `copilot` (existing bug)
- [x] Handle modal dismissal should sign out if not in signed in state
(existing bug)

Release Notes:

- You can now sign into Copilot from assistant settings without making
it your edit prediction provider. This is useful if you want to use
Copilot chat while keeping a different provider, like Zed, for
predictions.
- Removed the `copilot` key from `features` in settings. Use
`edit_prediction_provider` instead.
This commit is contained in:
Smit Barmase 2025-03-14 09:40:56 +00:00 committed by GitHub
parent 8d7b021f92
commit 6a95ec6a64
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 114 additions and 61 deletions

View file

@ -580,8 +580,6 @@ pub struct CopilotSettingsContent {
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct FeaturesContent {
/// Whether the GitHub Copilot feature is enabled.
pub copilot: Option<bool>,
/// Determines which edit prediction provider to use.
pub edit_prediction_provider: Option<EditPredictionProvider>,
}
@ -1158,7 +1156,6 @@ impl settings::Settings for AllLanguageSettings {
languages.insert(language_name.clone(), language_settings);
}
let mut copilot_enabled = default_value.features.as_ref().and_then(|f| f.copilot);
let mut edit_prediction_provider = default_value
.features
.as_ref()
@ -1205,9 +1202,6 @@ impl settings::Settings for AllLanguageSettings {
}
for user_settings in sources.customizations() {
if let Some(copilot) = user_settings.features.as_ref().and_then(|f| f.copilot) {
copilot_enabled = Some(copilot);
}
if let Some(provider) = user_settings
.features
.as_ref()
@ -1282,8 +1276,6 @@ impl settings::Settings for AllLanguageSettings {
edit_predictions: EditPredictionSettings {
provider: if let Some(provider) = edit_prediction_provider {
provider
} else if copilot_enabled.unwrap_or(true) {
EditPredictionProvider::Copilot
} else {
EditPredictionProvider::None
},