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\\(([^)]*)\\)", "[\"'`]([^\"'`]+)[\"'`]" }, + }, + }, + ''; + }; }; };