From 2d8093f468010de3ddf4af29852bfd62b3100ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien?= Date: Sat, 22 Nov 2025 23:44:12 +0100 Subject: [PATCH] feat(tailwind): allow for custom options in LSP (example with `cva`) --- docs/release-notes/rl-0.8.md | 5 +++++ modules/plugins/languages/tailwind.nix | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 5914df92..b4f03e03 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -510,3 +510,8 @@ - Add inline typst concealing support under `vim.languages.typst` using [typst-concealer]. + +[Shyrogan](https://github.com/Shyrogan): + +- Add `vim.languages.tailwind.lsp.opts` option to Tailwind (for third party such as + [cva](https://beta.cva.style/)) along an example on how to use it. diff --git a/modules/plugins/languages/tailwind.nix b/modules/plugins/languages/tailwind.nix index fbe707ba..d35db7c1 100644 --- a/modules/plugins/languages/tailwind.nix +++ b/modules/plugins/languages/tailwind.nix @@ -21,6 +21,11 @@ lspconfig.tailwindcss.setup { capabilities = capabilities; on_attach = default_on_attach; + settings = { + tailwindCSS = { + ${cfg.lsp.opts} + }, + }, cmd = ${ if isList cfg.lsp.package then expToLua cfg.lsp.package @@ -49,6 +54,19 @@ in { type = either package (listOf str); default = servers.${cfg.lsp.server}.package; }; + + opts = mkOption { + description = "Options to pass to tailwindcss-lsp"; + type = str; + default = ""; + example = '' + experimental = { + classRegex = { + { "cva\\(([^)]*)\\)", "[\"'`]([^\"'`]+)[\"'`]" }, + }, + }, + ''; + }; }; };