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

@ -3,7 +3,7 @@ use crate::{
environment::ProjectEnvironment,
lsp_command::{self, *},
lsp_ext_command,
project_settings::ProjectSettings,
project_settings::{LspSettings, ProjectSettings},
relativize_path, resolve_path,
worktree_store::{WorktreeStore, WorktreeStoreEvent},
yarn::YarnPathStore,
@ -7035,6 +7035,23 @@ impl HttpClient for BlockedHttpClient {
None
}
}
pub fn language_server_settings<'a, 'b: 'a>(
delegate: &'a dyn LspAdapterDelegate,
language: &str,
cx: &'b AppContext,
) -> Option<&'a LspSettings> {
ProjectSettings::get(
Some(SettingsLocation {
worktree_id: delegate.worktree_id(),
path: delegate.worktree_root_path(),
}),
cx,
)
.lsp
.get(language)
}
#[async_trait]
impl LspAdapterDelegate for ProjectLspAdapterDelegate {
fn show_notification(&self, message: &str, cx: &mut AppContext) {