Use a proper settings location for yaml (#17006)

Release Notes:

- N/A

Co-authored-by: Marshall Bowers <marshall@zed.dev>
This commit is contained in:
Kirill Bulatov 2024-08-28 18:00:38 +03:00 committed by GitHub
parent 7e1eac67ef
commit 98d74f9317
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,11 +3,12 @@ use async_trait::async_trait;
use futures::StreamExt; use futures::StreamExt;
use gpui::AsyncAppContext; use gpui::AsyncAppContext;
use language::{ use language::{
language_settings::all_language_settings, LanguageServerName, LspAdapter, LspAdapterDelegate, language_settings::AllLanguageSettings, LanguageServerName, LspAdapter, LspAdapterDelegate,
}; };
use lsp::LanguageServerBinary; use lsp::LanguageServerBinary;
use node_runtime::NodeRuntime; use node_runtime::NodeRuntime;
use serde_json::Value; use serde_json::Value;
use settings::{Settings, SettingsLocation};
use smol::fs; use smol::fs;
use std::{ use std::{
any::Any, any::Any,
@ -95,11 +96,16 @@ impl LspAdapter for YamlLspAdapter {
async fn workspace_configuration( async fn workspace_configuration(
self: Arc<Self>, self: Arc<Self>,
_: &Arc<dyn LspAdapterDelegate>, delegate: &Arc<dyn LspAdapterDelegate>,
cx: &mut AsyncAppContext, cx: &mut AsyncAppContext,
) -> Result<Value> { ) -> Result<Value> {
let location = SettingsLocation {
worktree_id: delegate.worktree_id() as usize,
path: delegate.worktree_root_path(),
};
let tab_size = cx.update(|cx| { let tab_size = cx.update(|cx| {
all_language_settings(None, cx) AllLanguageSettings::get(Some(location), cx)
.language(Some("YAML")) .language(Some("YAML"))
.tab_size .tab_size
})?; })?;