Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Workspace configuration for elixir-ls LSP (#9330)
Richard Taylor5181d3f71907
diff --git a/crates/languages/src/elixir.rs b/crates/languages/src/elixir.rsindex 26dfb3c2036..6a7be48be5e 100644--- a/crates/languages/src/elixir.rs+++ b/crates/languages/src/elixir.rs@@ -1,18 +1,20 @@use anyhow::{anyhow, bail, Context, Result};use async_trait::async_trait;use futures::StreamExt;-use gpui::{AsyncAppContext, Task};+use gpui::{AppContext, AsyncAppContext, Task};pub use language::*;use lsp::{CompletionItemKind, LanguageServerBinary, SymbolKind};+use project::project_settings::ProjectSettings;use schemars::JsonSchema;use serde_derive::{Deserialize, Serialize};+use serde_json::Value;use settings::Settings;use smol::fs::{self, File};use std::{any::Any,env::consts,ops::Deref,- path::PathBuf,+ path::{Path, PathBuf},sync::{atomic::{AtomicBool, Ordering::SeqCst},Arc,@@ -272,6 +274,18 @@ impl LspAdapter for ElixirLspAdapter {filter_range,})}++ fn workspace_configuration(&self, _workspace_root: &Path, cx: &mut AppContext) -> Value {+ let settings = ProjectSettings::get_global(cx)+ .lsp+ .get("elixir-ls")+ .and_then(|s| s.settings.clone())+ .unwrap_or_default();++ serde_json::json!({+ "elixirLS": settings+ })+ }}async fn get_cached_server_binary_elixir_ls(diff --git a/docs/src/languages/elixir.md b/docs/src/languages/elixir.mdindex 23eb2530d9e..22df3562a55 100644--- a/docs/src/languages/elixir.md+++ b/docs/src/languages/elixir.md@@ -39,3 +39,21 @@ If you prefer to format your code with [Mix](https://hexdocs.pm/mix/Mix.html), u}}```++### Additional workspace configuration options (requires Zed `0.128.0`):++You can pass additional elixir-ls workspace configuration options via lsp settings in `settings.json`.++The following example disables dialyzer:++```json+"lsp": {+ "elixir-ls": {+ "settings": {+ "dialyzerEnabled": false+ }+ }+}+```++See [ElixirLS configuration settings](https://github.com/elixir-lsp/elixir-ls#elixirls-configuration-settings) for more options.