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.

docs: Add Tailwind LSP configuration section for Go (Templ) (#55255)

Tautik Agraharib1f456390942
diff --git a/docs/src/languages/go.md b/docs/src/languages/go.md
index c535acd80f0..c7ed310b3bd 100644
--- a/docs/src/languages/go.md
+++ b/docs/src/languages/go.md
@@ -234,3 +234,33 @@ In such case Zed won't spawn a new instance of Delve, as it opts to use an exist
- Tree-sitter:
[tree-sitter-go-work](https://github.com/d1y/tree-sitter-go-work)
- Language Server: N/A
+
+## Using the Tailwind CSS Language Server with Templ
+
+To get all the features (autocomplete, linting, etc.) from the [Tailwind CSS language server](https://github.com/tailwindlabs/tailwindcss-intellisense/tree/HEAD/packages/tailwindcss-language-server#readme) in [Templ](https://github.com/a-h/templ) files, you need to enable the language server for Templ and configure where it should look for CSS classes by adding the following to your `settings.json`:
+
+```json [settings]
+{
+ "languages": {
+ "Templ": {
+ "language_servers": ["tailwindcss-language-server", "..."]
+ }
+ },
+ "lsp": {
+ "tailwindcss-language-server": {
+ "settings": {
+ "includeLanguages": {
+ "templ": "html"
+ },
+ "experimental": {
+ "classRegex": ["class=\"([^\"]*)\""]
+ }
+ }
+ }
+ }
+}
+```
+
+> Note: Unlike other languages, you need to tell Tailwind to treat `.templ` files as HTML explicitly.
+
+This gives you Tailwind CSS completions inside `class="..."` attributes in your `.templ` files.
diff --git a/docs/src/languages/tailwindcss.md b/docs/src/languages/tailwindcss.md
index 4644549ea0b..2c95d85a6ca 100644
--- a/docs/src/languages/tailwindcss.md
+++ b/docs/src/languages/tailwindcss.md
@@ -15,6 +15,7 @@ Languages which can be used with Tailwind CSS in Zed:
- [CSS](./css.md)
- [ERB](./ruby.md#using-the-tailwind-css-language-server-with-ruby)
- [Gleam](./gleam.md#using-the-tailwind-css-language-server-with-gleam)
+- [Go (Templ)](./go.md#using-the-tailwind-css-language-server-with-templ)
- [HEEx](./elixir.md#using-the-tailwind-css-language-server-with-heex-templates)
- [HTML](./html.md#using-the-tailwind-css-language-server-with-html)
- [TypeScript](./typescript.md#using-the-tailwind-css-language-server-with-typescript)