Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

tailwind: Check user settings for `classAttributes` (#13923)

Thorsten Balla1eaf1bb3cbc
diff --git a/crates/languages/src/tailwind.rs b/crates/languages/src/tailwind.rs
index f872b5a56a2..ab93ed74a3a 100644
--- a/crates/languages/src/tailwind.rs
+++ b/crates/languages/src/tailwind.rs
@@ -158,26 +158,25 @@ impl LspAdapter for TailwindLspAdapter {
.unwrap_or_default()
})?;
- // We need to set this to null if it's not set, because tailwindcss-languageserver
- // will check whether it's an object and if it is (even if it's empty) it will
- // ignore the `userLanguages` from the initialization options.
- let include_languages = tailwind_user_settings
- .get("includeLanguages")
- .cloned()
- .unwrap_or(Value::Null);
-
- let experimental = tailwind_user_settings
- .get("experimental")
- .cloned()
- .unwrap_or_else(|| json!([]));
-
- Ok(json!({
+ let mut configuration = json!({
"tailwindCSS": {
"emmetCompletions": true,
- "includeLanguages": include_languages,
- "experimental": experimental,
}
- }))
+ });
+
+ if let Some(experimental) = tailwind_user_settings.get("experimental").cloned() {
+ configuration["tailwindCSS"]["experimental"] = experimental;
+ }
+
+ 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)
}
fn language_ids(&self) -> HashMap<String, String> {