Magic incantations for Tailwind autocomplete in more languages (#3141)

Release Notes:
- Added Tailwind autocomplete to Svelte files
([#2029](https://github.com/zed-industries/community/issues/2029)).
- Added Tailwind autocomplete to Phoenix HEEX files
([#2057](https://github.com/zed-industries/community/issues/2057)).
- Added Tailwind autocomplete to Phoenix ~H sigil in Elixir files
([#2057](https://github.com/zed-industries/community/issues/2057)).
- Added Tailwind autocomplete to ERB files
([#2153](https://github.com/zed-industries/community/issues/2153)).
- Added Tailwind autocomplete to PHP files
([#2159](https://github.com/zed-industries/community/issues/2159)).
- Added Tailwind autocomplete to Laravel Blade files
([#2159](https://github.com/zed-industries/community/issues/2159)).
This commit is contained in:
Julia 2023-10-20 12:02:55 -04:00 committed by GitHub
commit 808976ee28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 40 additions and 8 deletions

View File

@ -76,7 +76,10 @@ pub fn init(
elixir::ElixirLspSetting::ElixirLs => language(
"elixir",
tree_sitter_elixir::language(),
vec![Arc::new(elixir::ElixirLspAdapter)],
vec![
Arc::new(elixir::ElixirLspAdapter),
Arc::new(tailwind::TailwindLspAdapter::new(node_runtime.clone())),
],
),
elixir::ElixirLspSetting::NextLs => language(
"elixir",
@ -101,7 +104,10 @@ pub fn init(
language(
"heex",
tree_sitter_heex::language(),
vec![Arc::new(elixir::ElixirLspAdapter)],
vec![
Arc::new(elixir::ElixirLspAdapter),
Arc::new(tailwind::TailwindLspAdapter::new(node_runtime.clone())),
],
);
language(
"json",
@ -184,9 +190,10 @@ pub fn init(
language(
"svelte",
tree_sitter_svelte::language(),
vec![Arc::new(svelte::SvelteLspAdapter::new(
node_runtime.clone(),
))],
vec![
Arc::new(svelte::SvelteLspAdapter::new(node_runtime.clone())),
Arc::new(tailwind::TailwindLspAdapter::new(node_runtime.clone())),
],
);
language(
"php",

View File

@ -9,3 +9,8 @@ brackets = [
{ start = "\"", end = "\"", close = true, newline = false, not_in = ["string", "comment"] },
{ start = "'", end = "'", close = true, newline = false, not_in = ["string", "comment"] },
]
scope_opt_in_language_servers = ["tailwindcss-language-server"]
[overrides.string]
word_characters = ["-"]
opt_into_language_servers = ["tailwindcss-language-server"]

View File

@ -5,3 +5,8 @@ brackets = [
{ start = "<", end = ">", close = true, newline = true },
]
block_comment = ["<%!-- ", " --%>"]
scope_opt_in_language_servers = ["tailwindcss-language-server"]
[overrides.string]
word_characters = ["-"]
opt_into_language_servers = ["tailwindcss-language-server"]

View File

@ -0,0 +1,4 @@
[
(attribute_value)
(quoted_attribute_value)
] @string

View File

@ -12,7 +12,8 @@ brackets = [
{ start = "`", end = "`", close = true, newline = false, not_in = ["string"] },
{ start = "/*", end = " */", close = true, newline = false, not_in = ["string", "comment"] },
]
scope_opt_in_language_servers = ["tailwindcss-language-server"]
[overrides.element]
line_comment = { remove = true }
block_comment = ["{/* ", " */}"]
[overrides.string]
word_characters = ["-"]
opt_into_language_servers = ["tailwindcss-language-server"]

View File

@ -0,0 +1,7 @@
(comment) @comment
[
(raw_text)
(attribute_value)
(quoted_attribute_value)
] @string

View File

@ -123,6 +123,9 @@ impl LspAdapter for TailwindLspAdapter {
("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(),
)