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.

Add Tailwind autocomplete in ERB, PHP, and Laravel Blade

Julia7c3a8a37744d
diff --git a/crates/zed/src/languages.rs b/crates/zed/src/languages.rs
index e5b3dfdcae8..2398f81c78a 100644
--- a/crates/zed/src/languages.rs
+++ b/crates/zed/src/languages.rs
@@ -173,7 +173,10 @@ pub fn init(
language(
"erb",
tree_sitter_embedded_template::language(),
- vec![Arc::new(ruby::RubyLanguageServer)],
+ vec![
+ Arc::new(ruby::RubyLanguageServer),
+ Arc::new(tailwind::TailwindLspAdapter::new(node_runtime.clone())),
+ ],
);
language("scheme", tree_sitter_scheme::language(), vec![]);
language("racket", tree_sitter_racket::language(), vec![]);
@@ -198,9 +201,10 @@ pub fn init(
language(
"php",
tree_sitter_php::language(),
- vec![Arc::new(php::IntelephenseLspAdapter::new(
- node_runtime.clone(),
- ))],
+ vec![
+ Arc::new(php::IntelephenseLspAdapter::new(node_runtime.clone())),
+ Arc::new(tailwind::TailwindLspAdapter::new(node_runtime.clone())),
+ ],
);
language("elm", tree_sitter_elm::language(), vec![]);
diff --git a/crates/zed/src/languages/erb/config.toml b/crates/zed/src/languages/erb/config.toml
index 9cfcef0c8ba..ebc45e9984b 100644
--- a/crates/zed/src/languages/erb/config.toml
+++ b/crates/zed/src/languages/erb/config.toml
@@ -5,3 +5,4 @@ brackets = [
{ start = "<", end = ">", close = true, newline = true },
]
block_comment = ["<%#", "%>"]
+scope_opt_in_language_servers = ["tailwindcss-language-server"]
diff --git a/crates/zed/src/languages/php/config.toml b/crates/zed/src/languages/php/config.toml
index 60dd2335551..f5ad67c12d2 100644
--- a/crates/zed/src/languages/php/config.toml
+++ b/crates/zed/src/languages/php/config.toml
@@ -11,3 +11,4 @@ brackets = [
]
collapsed_placeholder = "/* ... */"
word_characters = ["$"]
+scope_opt_in_language_servers = ["tailwindcss-language-server"]
diff --git a/crates/zed/src/languages/tailwind.rs b/crates/zed/src/languages/tailwind.rs
index ef19b858be2..296d9a490b1 100644
--- a/crates/zed/src/languages/tailwind.rs
+++ b/crates/zed/src/languages/tailwind.rs
@@ -117,18 +117,17 @@ impl LspAdapter for TailwindLspAdapter {
}
async fn language_ids(&self) -> HashMap<String, String> {
- HashMap::from_iter(
- [
- ("HTML".to_string(), "html".to_string()),
- ("CSS".to_string(), "css".to_string()),
- ("JavaScript".to_string(), "javascript".to_string()),
- ("TSX".to_string(), "typescriptreact".to_string()),
- ("Svelte".to_string(), "svelte".to_string()),
- ("Elixir".to_string(), "phoenix-heex".to_string()),
- ("HEEX".to_string(), "phoenix-heex".to_string()),
- ]
- .into_iter(),
- )
+ HashMap::from_iter([
+ ("HTML".to_string(), "html".to_string()),
+ ("CSS".to_string(), "css".to_string()),
+ ("JavaScript".to_string(), "javascript".to_string()),
+ ("TSX".to_string(), "typescriptreact".to_string()),
+ ("Svelte".to_string(), "svelte".to_string()),
+ ("Elixir".to_string(), "phoenix-heex".to_string()),
+ ("HEEX".to_string(), "phoenix-heex".to_string()),
+ ("ERB".to_string(), "erb".to_string()),
+ ("PHP".to_string(), "php".to_string()),
+ ])
}
fn enabled_formatters(&self) -> Vec<BundledFormatter> {