Extract Elixir extension (#10948)

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

As part of this, [Lexical](https://github.com/lexical-lsp/lexical) has
been added as an available language server for Elixir.

Since the Elixir extension provides three different language servers,
you'll need to use the `language_servers` setting to select the one you
want to use:

#### Elixir LS

```json
{
  "languages": {
    "Elixir": {
      "language_servers": [ "elixir-ls", "!next-ls", "!lexical", "..."]
    }
  }
}
```

#### Next LS

```json
{
  "languages": {
    "Elixir": {
      "language_servers": [ "next-ls", "!elixir-ls", "!lexical", "..."]
    }
  }
}
```

#### Lexical

```json
{
  "languages": {
    "Elixir": {
      "language_servers": [ "lexical", "!elixir-ls", "!next-ls", "..."]
    }
  }
}
```

These can either go in your user settings or your project settings.

Release Notes:

- Removed built-in support for Elixir, in favor of making it available
as an extension.
This commit is contained in:
Marshall Bowers 2024-04-25 13:59:14 -04:00 committed by GitHub
parent 7065da2b98
commit 544bd490ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 671 additions and 689 deletions

View file

@ -3,22 +3,16 @@ use gpui::{AppContext, BorrowAppContext};
pub use language::*;
use node_runtime::NodeRuntime;
use rust_embed::RustEmbed;
use settings::{Settings, SettingsStore};
use settings::SettingsStore;
use smol::stream::StreamExt;
use std::{str, sync::Arc};
use util::{asset_str, ResultExt};
use crate::{
bash::bash_task_context, elixir::elixir_task_context, python::python_task_context,
rust::RustContextProvider,
};
use self::elixir::ElixirSettings;
use crate::{bash::bash_task_context, python::python_task_context, rust::RustContextProvider};
mod bash;
mod c;
mod css;
mod elixir;
mod go;
mod json;
mod python;
@ -47,14 +41,11 @@ pub fn init(
node_runtime: Arc<dyn NodeRuntime>,
cx: &mut AppContext,
) {
ElixirSettings::register(cx);
languages.register_native_grammars([
("bash", tree_sitter_bash::language()),
("c", tree_sitter_c::language()),
("cpp", tree_sitter_cpp::language()),
("css", tree_sitter_css::language()),
("elixir", tree_sitter_elixir::language()),
(
"embedded_template",
tree_sitter_embedded_template::language(),
@ -62,7 +53,6 @@ pub fn init(
("go", tree_sitter_go::language()),
("gomod", tree_sitter_gomod::language()),
("gowork", tree_sitter_gowork::language()),
("heex", tree_sitter_heex::language()),
("jsdoc", tree_sitter_jsdoc::language()),
("json", tree_sitter_json::language()),
("markdown", tree_sitter_markdown::language()),
@ -131,46 +121,9 @@ pub fn init(
Arc::new(tailwind::TailwindLspAdapter::new(node_runtime.clone())),
]
);
match &ElixirSettings::get(None, cx).lsp {
elixir::ElixirLspSetting::ElixirLs => {
language!(
"elixir",
vec![
Arc::new(elixir::ElixirLspAdapter),
Arc::new(tailwind::TailwindLspAdapter::new(node_runtime.clone())),
],
elixir_task_context()
);
}
elixir::ElixirLspSetting::NextLs => {
language!(
"elixir",
vec![Arc::new(elixir::NextLspAdapter)],
elixir_task_context()
);
}
elixir::ElixirLspSetting::Local { path, arguments } => {
language!(
"elixir",
vec![Arc::new(elixir::LocalLspAdapter {
path: path.clone(),
arguments: arguments.clone(),
})],
elixir_task_context()
);
}
}
language!("go", vec![Arc::new(go::GoLspAdapter)]);
language!("gomod");
language!("gowork");
language!(
"heex",
vec![
Arc::new(elixir::ElixirLspAdapter),
Arc::new(tailwind::TailwindLspAdapter::new(node_runtime.clone())),
]
);
language!(
"json",
vec![Arc::new(json::JsonLspAdapter::new(
@ -232,6 +185,7 @@ pub fn init(
let tailwind_languages = [
"Astro",
"HEEX",
"HTML",
"PHP",
"Svelte",