From 9e7afe870a6f1e9a3a2debf65048a22ca0292271 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Mon, 11 Nov 2024 17:13:00 +0100 Subject: [PATCH] tailwind: Allow configuring the `rootFontSize` (#20500) This addresses this comment: https://github.com/zed-industries/zed/pull/13923#issuecomment-2467213210 With the change in here it's now possible to use the following settings: ```json { "lsp": { "tailwindcss-language-server": { "settings": { "rootFontSize": 50 } } } } ``` Closes https://github.com/zed-industries/zed/issues/10840 Release Notes: - Added ability to configure `rootFontSize` for the `tailwindcss-language-server`. Example settings: `{"lsp": {"tailwindcss-language-server": {"settings": { "rootFontSize": 50}}}}` Co-authored-by: Bennet --- crates/languages/src/tailwind.rs | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/crates/languages/src/tailwind.rs b/crates/languages/src/tailwind.rs index f1b5b87a2c..e2ced0f67f 100644 --- a/crates/languages/src/tailwind.rs +++ b/crates/languages/src/tailwind.rs @@ -114,31 +114,19 @@ impl LspAdapter for TailwindLspAdapter { _: Arc, cx: &mut AsyncAppContext, ) -> Result { - let tailwind_user_settings = cx.update(|cx| { + let mut tailwind_user_settings = cx.update(|cx| { language_server_settings(delegate.as_ref(), &Self::SERVER_NAME, cx) .and_then(|s| s.settings.clone()) .unwrap_or_default() })?; - let mut configuration = json!({ - "tailwindCSS": { - "emmetCompletions": true, - } - }); - - if let Some(experimental) = tailwind_user_settings.get("experimental").cloned() { - configuration["tailwindCSS"]["experimental"] = experimental; + if tailwind_user_settings.get("emmetCompletions").is_none() { + tailwind_user_settings["emmetCompletions"] = Value::Bool(true); } - if let Some(class_attributes) = tailwind_user_settings.get("classAttributes").cloned() { - configuration["tailwindCSS"]["classAttributes"] = class_attributes; - } - - if let Some(include_languages) = tailwind_user_settings.get("includeLanguages").cloned() { - configuration["tailwindCSS"]["includeLanguages"] = include_languages; - } - - Ok(configuration) + Ok(json!({ + "tailwindCSS": tailwind_user_settings, + })) } fn language_ids(&self) -> HashMap {