lsp: Use project-local settings if available (#17753)
Release Notes: - Changed built-in language support (Rust, Go, C, YAML, ...) to lookup language-server specific settings locally in project directory first before falling back to global value. --------- Co-authored-by: Bennet <bennet@zed.dev>
This commit is contained in:
parent
092f29d394
commit
9db68ee6ae
9 changed files with 47 additions and 70 deletions
|
@ -7,7 +7,7 @@ use language::{
|
|||
};
|
||||
use lsp::LanguageServerBinary;
|
||||
use node_runtime::NodeRuntime;
|
||||
use project::project_settings::ProjectSettings;
|
||||
use project::lsp_store::language_server_settings;
|
||||
use serde_json::Value;
|
||||
use settings::{Settings, SettingsLocation};
|
||||
use smol::fs;
|
||||
|
@ -44,14 +44,12 @@ impl LspAdapter for YamlLspAdapter {
|
|||
|
||||
async fn check_if_user_installed(
|
||||
&self,
|
||||
_delegate: &dyn LspAdapterDelegate,
|
||||
delegate: &dyn LspAdapterDelegate,
|
||||
cx: &AsyncAppContext,
|
||||
) -> Option<LanguageServerBinary> {
|
||||
let configured_binary = cx
|
||||
.update(|cx| {
|
||||
ProjectSettings::get_global(cx)
|
||||
.lsp
|
||||
.get(Self::SERVER_NAME)
|
||||
language_server_settings(delegate, Self::SERVER_NAME, cx)
|
||||
.and_then(|s| s.binary.clone())
|
||||
})
|
||||
.ok()??;
|
||||
|
@ -147,9 +145,7 @@ impl LspAdapter for YamlLspAdapter {
|
|||
let mut options = serde_json::json!({"[yaml]": {"editor.tabSize": tab_size}});
|
||||
|
||||
let project_options = cx.update(|cx| {
|
||||
ProjectSettings::get_global(cx)
|
||||
.lsp
|
||||
.get(Self::SERVER_NAME)
|
||||
language_server_settings(delegate.as_ref(), Self::SERVER_NAME, cx)
|
||||
.and_then(|s| s.initialization_options.clone())
|
||||
})?;
|
||||
if let Some(override_options) = project_options {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue