diff --git a/docs/src/languages/astro.md b/docs/src/languages/astro.md index cbfe8de74e7444e2e02f6240265e00eb043a2084..70b5e7fe534f2d2d333a6a1bc1dd0c41bc0fa24c 100644 --- a/docs/src/languages/astro.md +++ b/docs/src/languages/astro.md @@ -5,6 +5,51 @@ Astro support is available through the [Astro extension](https://github.com/zed- - Tree-sitter: [virchau13/tree-sitter-astro](https://github.com/virchau13/tree-sitter-astro) - Language Server: [withastro/language-tools](https://github.com/withastro/astro/tree/main/packages/language-tools/language-server) - +## Using the Tailwind CSS Language Server with Astro + +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 Astro files, you need to configure the language server so that it knows about where to look for CSS classes by adding the following to your `settings.json`: + +```json [settings] +{ + "lsp": { + "tailwindcss-language-server": { + "settings": { + "includeLanguages": { + "astro": "html" + }, + "experimental": { + "classRegex": [ + "class=\"([^\"]*)\"", + "class='([^']*)'", + "class:list=\"{([^}]*)}\"", + "class:list='{([^}]*)}'" + ] + } + } + } + } +} +``` + +With these settings, you will get completions for Tailwind CSS classes in Astro template files. Examples: + +```astro +--- +const active = true; +--- + + +
+

Hello World

+
+ + +
"]}> + Content +
+ + +
": active, "hidden ": !active }}> + Content +
+``` diff --git a/docs/src/languages/elixir.md b/docs/src/languages/elixir.md index 3df116492ae097f30e7da041a2643e085570f61c..c4d6457e48c4ddb2053f7e457dc88b9e0216ff8b 100644 --- a/docs/src/languages/elixir.md +++ b/docs/src/languages/elixir.md @@ -123,3 +123,43 @@ See [ElixirLS configuration settings](https://github.com/elixir-lsp/elixir-ls#el Zed also supports HEEx templates. HEEx is a mix of [EEx](https://hexdocs.pm/eex/1.12.3/EEx.html) (Embedded Elixir) and HTML, and is used in Phoenix LiveView applications. - Tree-sitter: [phoenixframework/tree-sitter-heex](https://github.com/phoenixframework/tree-sitter-heex) + +#### Using the Tailwind CSS Language Server with HEEx + +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 HEEx files, you need to configure the language server so that it knows about where to look for CSS classes by adding the following to your `settings.json`: + +```json [settings] +{ + "lsp": { + "tailwindcss-language-server": { + "settings": { + "includeLanguages": { + "phoenix-heex": "html" + }, + "experimental": { + "classRegex": ["class=\"([^\"]*)\"", "class='([^']*)'"] + } + } + } + } +} +``` + +With these settings, you will get completions for Tailwind CSS classes in HEEx template files. Examples: + +```heex +<%!-- Standard class attribute --%> +
+

Hello World

+
+ +<%!-- With Elixir expression --%> +
"}> + Content +
+ +<%!-- With Phoenix function --%> +
"])}> + Content +
+``` diff --git a/docs/src/languages/html.md b/docs/src/languages/html.md index 274083adee504f68852895b3e66c4f7b78ecdfff..dba40a28cc73429afb2bb20275f3c58c1cd4de99 100644 --- a/docs/src/languages/html.md +++ b/docs/src/languages/html.md @@ -64,6 +64,32 @@ You can customize various [formatting options](https://code.visualstudio.com/doc } ``` +## Using the Tailwind CSS Language Server with HTML + +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 HTML files, you need to configure the language server so that it knows about where to look for CSS classes by adding the following to your `settings.json`: + +```json [settings] +{ + "lsp": { + "tailwindcss-language-server": { + "settings": { + "experimental": { + "classRegex": ["class=\"([^\"]*)\""] + } + } + } + } +} +``` + +With these settings, you will get completions for Tailwind CSS classes in HTML `class` attributes. Examples: + +```html +
+

Hello World

+
+``` + ## See also - [CSS](./css.md) diff --git a/docs/src/languages/php.md b/docs/src/languages/php.md index 1a9f1cdadef394f1178fed87d4061eb0f3232cfd..c0978b7c29eb6837680765ca99bdef3d290181b3 100644 --- a/docs/src/languages/php.md +++ b/docs/src/languages/php.md @@ -149,8 +149,80 @@ The PHP extension provides a debug adapter for PHP via Xdebug. There are several These are common troubleshooting tips, in case you run into issues: -- Ensure that you have Xdebug installed for the version of PHP you’re running. +- Ensure that you have Xdebug installed for the version of PHP you're running. - Ensure that Xdebug is configured to run in `debug` mode. - Ensure that Xdebug is actually starting a debugging session. - Ensure that the host and port matches between Xdebug and Zed. -- Look at the diagnostics log by using the `xdebug_info()` function in the page you’re trying to debug. +- Look at the diagnostics log by using the `xdebug_info()` function in the page you're trying to debug. + +## Using the Tailwind CSS Language Server with PHP + +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 PHP files, you need to configure the language server so that it knows about where to look for CSS classes by adding the following to your `settings.json`: + +```json [settings] +{ + "lsp": { + "tailwindcss-language-server": { + "settings": { + "includeLanguages": { + "php": "html" + }, + "experimental": { + "classRegex": [ + "class=\"([^\"]*)\"", + "class='([^']*)'", + "class=\\\"([^\\\"]*)\\\"" + ] + } + } + } + } +} +``` + +With these settings, you will get completions for Tailwind CSS classes in HTML attributes inside PHP files. Examples: + +```php + +
+

Hello World

+
+``` + +### Laravel/Blade + +For Laravel/Blade files, you may need additional configuration to handle Blade directives: + +```json [settings] +{ + "lsp": { + "tailwindcss-language-server": { + "settings": { + "includeLanguages": { + "php": "html", + "blade": "html" + }, + "experimental": { + "classRegex": [ + "class=\"([^\"]*)\"", + "class='([^']*)'", + "class=\\\"([^\\\"]*)\\\"", + "@class\\(\\[([^\\]]*)\\]\\)" + ] + } + } + } + } +} +``` + +This will also provide completions in Blade directives like: + +```blade +{{-- Blade file --}} +
+ @class(['flex', 'items-center', '']) +
+``` diff --git a/docs/src/languages/svelte.md b/docs/src/languages/svelte.md index 139195987b1ebb4b78cc19e988c0bbbcf927fb27..941c8fdf9bfb1233665bda7579fb8de453a4b7ed 100644 --- a/docs/src/languages/svelte.md +++ b/docs/src/languages/svelte.md @@ -71,3 +71,47 @@ To override these settings, use the following: ``` See [the TypeScript language server `package.json`](https://github.com/microsoft/vscode/blob/main/extensions/typescript-language-features/package.json) for more information. + +## Using the Tailwind CSS Language Server with Svelte + +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 Svelte files, you need to configure the language server so that it knows about where to look for CSS classes by adding the following to your `settings.json`: + +```json [settings] +{ + "lsp": { + "tailwindcss-language-server": { + "settings": { + "includeLanguages": { + "svelte": "html" + }, + "experimental": { + "classRegex": [ + "class=\"([^\"]*)\"", + "class='([^']*)'", + "class:\\s*([^\\s{]+)", + "\\{\\s*class:\\s*\"([^\"]*)\"", + "\\{\\s*class:\\s*'([^']*)'" + ] + } + } + } + } +} +``` + +With these settings, you will get completions for Tailwind CSS classes in Svelte files. Examples: + +```svelte + +
+

Hello World

+
+ + + + + +
" : "hidden "}> + Content +
+``` diff --git a/docs/src/languages/tailwindcss.md b/docs/src/languages/tailwindcss.md index 4fa2036b21bcea2e09a6bd059c1f399528b373be..30316e516f413ae8e7b5c7fdfd7f9b03ae43d04d 100644 --- a/docs/src/languages/tailwindcss.md +++ b/docs/src/languages/tailwindcss.md @@ -6,17 +6,17 @@ Zed has built-in support for Tailwind CSS autocomplete, linting, and hover previ Languages which can be used with Tailwind CSS in Zed: -- [Astro](./astro.md) +- [Astro](./astro.md#using-the-tailwind-css-language-server-with-astro) - [CSS](./css.md) -- [ERB](./ruby.md) +- [ERB](./ruby.md#using-the-tailwind-css-language-server-with-ruby) - [Gleam](./gleam.md) -- [HEEx](./elixir.md#heex) -- [HTML](./html.md) -- [TypeScript](./typescript.md) -- [JavaScript](./javascript.md) -- [PHP](./php.md) -- [Svelte](./svelte.md) -- [Vue](./vue.md) +- [HEEx](./elixir.md#using-the-tailwind-css-language-server-with-heex) +- [HTML](./html.md#using-the-tailwind-css-language-server-with-html) +- [TypeScript](./typescript.md#using-the-tailwind-css-language-server-with-typescript) +- [JavaScript](./javascript.md#using-the-tailwind-css-language-server-with-javascript) +- [PHP](./php.md#using-the-tailwind-css-language-server-with-php) +- [Svelte](./svelte.md#using-the-tailwind-css-language-server-with-svelte) +- [Vue](./vue.md#using-the-tailwind-css-language-server-with-vue) ## Configuration diff --git a/docs/src/languages/vue.md b/docs/src/languages/vue.md index b8997d22376ae312c812d79915bb1451a86022d5..d4a1f8c3097a5fecb41f5496ccc75dce782adb81 100644 --- a/docs/src/languages/vue.md +++ b/docs/src/languages/vue.md @@ -4,3 +4,62 @@ Vue support is available through the [Vue extension](https://github.com/zed-exte - Tree-sitter: [tree-sitter-grammars/tree-sitter-vue](https://github.com/tree-sitter-grammars/tree-sitter-vue) - Language Server: [vuejs/language-tools/](https://github.com/vuejs/language-tools/) + +## Using the Tailwind CSS Language Server with Vue + +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 Vue files, you need to configure the language server so that it knows about where to look for CSS classes by adding the following to your `settings.json`: + +```json [settings] +{ + "lsp": { + "tailwindcss-language-server": { + "settings": { + "includeLanguages": { + "vue": "html" + }, + "experimental": { + "classRegex": [ + "class=\"([^\"]*)\"", + "class='([^']*)'", + ":class=\"([^\"]*)\"", + ":class='([^']*)'" + ] + } + } + } + } +} +``` + +With these settings, you will get completions for Tailwind CSS classes in Vue template files. Examples: + +```vue + +```