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 <kirill@zed.dev>
This commit is contained in:
1 parent
373c652df7
commit
aa14836bb4
1 file changed
+19
-2
@@ -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<Self>,
|
||||
delegate: &Arc<dyn LspAdapterDelegate>,
|
||||
_: Option<Toolchain>,
|
||||
_: Option<Uri>,
|
||||
cx: &mut AsyncApp,
|
||||
) -> Result<Value> {
|
||||
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)]
|
||||
|
||||
Reference in new issue
Block a user