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:
Thorsten Ball 2024-09-12 09:47:25 -04:00 committed by GitHub
parent 092f29d394
commit 9db68ee6ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 47 additions and 70 deletions

View file

@ -7,9 +7,8 @@ use http_client::github::{latest_github_release, GitHubLspBinaryVersion};
pub use language::*;
use language_settings::all_language_settings;
use lsp::LanguageServerBinary;
use project::project_settings::{BinarySettings, ProjectSettings};
use project::{lsp_store::language_server_settings, project_settings::BinarySettings};
use regex::Regex;
use settings::Settings;
use smol::fs::{self, File};
use std::{
any::Any,
@ -40,10 +39,7 @@ impl LspAdapter for RustLspAdapter {
cx: &AsyncAppContext,
) -> Option<LanguageServerBinary> {
let configured_binary = cx.update(|cx| {
ProjectSettings::get_global(cx)
.lsp
.get(Self::SERVER_NAME)
.and_then(|s| s.binary.clone())
language_server_settings(delegate, Self::SERVER_NAME, cx).and_then(|s| s.binary.clone())
});
match configured_binary {