From aa14836bb49923a7ed301a107a77cc9515067950 Mon Sep 17 00:00:00 2001 From: Cathal Date: Wed, 19 Aug 2026 17:27:34 +0000 Subject: [PATCH] bash: Hook up workspace configuration for `bash-language-server` (#57487) Allows configuring the Bash LSP. Tested with the following config: ```json "bash-language-server": { "binary": { "path": "bash-language-server", "arguments": ["start"] }, "settings": { "bashIde": { "shfmt": { "binaryNextLine": true, "caseIndent": true, "spaceRedirects": true, "simplifyCode": true } } } } ``` Config options [defined here](https://github.com/bash-lsp/bash-language-server/blob/main/server/src/config.ts), all prefixed with `bashIde`. Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Added support for configuring the Bash LSP adapter. Co-authored-by: Kirill Bulatov --- crates/languages/src/bash.rs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/crates/languages/src/bash.rs b/crates/languages/src/bash.rs index 2335b0a170..103cacdc16 100644 --- a/crates/languages/src/bash.rs +++ b/crates/languages/src/bash.rs @@ -1,11 +1,13 @@ use anyhow::Result; use async_trait::async_trait; use collections::HashMap; +use gpui::AsyncApp; use language::{LanguageServerName, LspAdapter, LspAdapterDelegate, LspInstaller, Toolchain}; -use lsp::LanguageServerBinary; +use lsp::{LanguageServerBinary, Uri}; use node_runtime::{NodeRuntime, VersionStrategy}; -use project::ContextProviderWithTasks; +use project::{ContextProviderWithTasks, lsp_store::language_server_settings}; use semver::Version; +use serde_json::Value; use std::{future::Future, path::PathBuf, sync::Arc, vec}; use task::{TaskTemplate, TaskTemplates, VariableName}; use util::{ResultExt, maybe}; @@ -171,6 +173,21 @@ impl LspAdapter for BashLspAdapter { fn name(&self) -> LanguageServerName { LanguageServerName::new_static(Self::PACKAGE_NAME) } + + async fn workspace_configuration( + self: Arc, + delegate: &Arc, + _: Option, + _: Option, + cx: &mut AsyncApp, + ) -> Result { + let settings = cx.update(|cx| { + language_server_settings(delegate.as_ref(), &self.name(), cx) + .and_then(|s| s.settings.clone()) + }); + + Ok(settings.unwrap_or_default()) + } } #[cfg(test)]