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:
commit
808976ee28
7 changed files with 40 additions and 8 deletions
|
@ -76,7 +76,10 @@ pub fn init(
|
||||||
elixir::ElixirLspSetting::ElixirLs => language(
|
elixir::ElixirLspSetting::ElixirLs => language(
|
||||||
"elixir",
|
"elixir",
|
||||||
tree_sitter_elixir::language(),
|
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::ElixirLspSetting::NextLs => language(
|
||||||
"elixir",
|
"elixir",
|
||||||
|
@ -101,7 +104,10 @@ pub fn init(
|
||||||
language(
|
language(
|
||||||
"heex",
|
"heex",
|
||||||
tree_sitter_heex::language(),
|
tree_sitter_heex::language(),
|
||||||
vec![Arc::new(elixir::ElixirLspAdapter)],
|
vec![
|
||||||
|
Arc::new(elixir::ElixirLspAdapter),
|
||||||
|
Arc::new(tailwind::TailwindLspAdapter::new(node_runtime.clone())),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
language(
|
language(
|
||||||
"json",
|
"json",
|
||||||
|
@ -184,9 +190,10 @@ pub fn init(
|
||||||
language(
|
language(
|
||||||
"svelte",
|
"svelte",
|
||||||
tree_sitter_svelte::language(),
|
tree_sitter_svelte::language(),
|
||||||
vec![Arc::new(svelte::SvelteLspAdapter::new(
|
vec![
|
||||||
node_runtime.clone(),
|
Arc::new(svelte::SvelteLspAdapter::new(node_runtime.clone())),
|
||||||
))],
|
Arc::new(tailwind::TailwindLspAdapter::new(node_runtime.clone())),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
language(
|
language(
|
||||||
"php",
|
"php",
|
||||||
|
|
|
@ -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"] },
|
||||||
{ 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"]
|
||||||
|
|
|
@ -5,3 +5,8 @@ brackets = [
|
||||||
{ start = "<", end = ">", close = true, newline = true },
|
{ start = "<", end = ">", close = true, newline = true },
|
||||||
]
|
]
|
||||||
block_comment = ["<%!-- ", " --%>"]
|
block_comment = ["<%!-- ", " --%>"]
|
||||||
|
scope_opt_in_language_servers = ["tailwindcss-language-server"]
|
||||||
|
|
||||||
|
[overrides.string]
|
||||||
|
word_characters = ["-"]
|
||||||
|
opt_into_language_servers = ["tailwindcss-language-server"]
|
||||||
|
|
4
crates/zed/src/languages/heex/overrides.scm
Normal file
4
crates/zed/src/languages/heex/overrides.scm
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
[
|
||||||
|
(attribute_value)
|
||||||
|
(quoted_attribute_value)
|
||||||
|
] @string
|
|
@ -12,7 +12,8 @@ brackets = [
|
||||||
{ start = "`", end = "`", close = true, newline = false, not_in = ["string"] },
|
{ start = "`", end = "`", close = true, newline = false, not_in = ["string"] },
|
||||||
{ 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.element]
|
[overrides.string]
|
||||||
line_comment = { remove = true }
|
word_characters = ["-"]
|
||||||
block_comment = ["{/* ", " */}"]
|
opt_into_language_servers = ["tailwindcss-language-server"]
|
||||||
|
|
7
crates/zed/src/languages/svelte/overrides.scm
Normal file
7
crates/zed/src/languages/svelte/overrides.scm
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
(comment) @comment
|
||||||
|
|
||||||
|
[
|
||||||
|
(raw_text)
|
||||||
|
(attribute_value)
|
||||||
|
(quoted_attribute_value)
|
||||||
|
] @string
|
|
@ -123,6 +123,9 @@ impl LspAdapter for TailwindLspAdapter {
|
||||||
("CSS".to_string(), "css".to_string()),
|
("CSS".to_string(), "css".to_string()),
|
||||||
("JavaScript".to_string(), "javascript".to_string()),
|
("JavaScript".to_string(), "javascript".to_string()),
|
||||||
("TSX".to_string(), "typescriptreact".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(),
|
.into_iter(),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue