Extract PHP support into an extension (#9966)

This PR extracts PHP support into an extension and removes the built-in
PHP support from Zed.

There's a small workaround necessary in order for us to provide the
`language_ids` on the `LspAdapter` that are needed for the language
server to run properly. Eventually we'll want to build this into the
extension API, but for now we're just hard-coding it on the host side.

Release Notes:

- Removed built-in support for PHP, in favor of making it available as
an extension. The PHP extension will be suggested for download when you
open a `.php` file.
This commit is contained in:
Marshall Bowers 2024-03-29 14:51:54 -04:00 committed by GitHub
parent 764e256755
commit e252f90e30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 143 additions and 157 deletions

View file

@ -1,6 +1,7 @@
use crate::wasm_host::{wit::LanguageServerConfig, WasmExtension, WasmHost};
use anyhow::{anyhow, Context, Result};
use async_trait::async_trait;
use collections::HashMap;
use futures::{Future, FutureExt};
use gpui::AsyncAppContext;
use language::{Language, LanguageServerName, LspAdapter, LspAdapterDelegate};
@ -106,6 +107,17 @@ impl LspAdapter for ExtensionLspAdapter {
None
}
fn language_ids(&self) -> HashMap<String, String> {
// TODO: Eventually we'll want to expose an extension API for doing this, but for
// now we just manually language ID mappings for extensions that we know need it.
if self.extension.manifest.id.as_ref() == "php" {
return HashMap::from_iter([("PHP".into(), "php".into())]);
}
Default::default()
}
async fn initialization_options(
self: Arc<Self>,
delegate: &Arc<dyn LspAdapterDelegate>,