From d2f9885d6b8244818066cc16a5c72cb656748f6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B8rn=20Vatn?= Date: Mon, 20 Oct 2025 11:07:12 +0200 Subject: [PATCH] fix(tailwind): additional settings (#5266) Make it possible to define your own tailwind settings in opts, and merge them with the default, additional Phoenix settings in tailwind.lua ## Description Add the possibility to add your own tailwind settings in opts and have them deep merged into the default `opts.settings` I needed this for configuring support for tailwind when coding on a [htmgo](https://htmgo.dev/docs/misc/tailwind-intellisense) project in Neovim. E.g. ```lua return { "neovim/nvim-lspconfig", opts = { servers = { tailwindcss = { filetypes_include = { "go" }, settings = { tailwindCSS = { includeLanguages = { go = "html", }, experimental = { classRegex = { { "Class\\(([^)]*)\\)", '["`]([^"`]*)["`]' }, { "ClassX\\(([^)]*)\\)", '["`]([^"`]*)["`]' }, { "ClassIf\\(([^)]*)\\)", '["`]([^"`]*)["`]' }, { "Classes\\(([^)]*)\\)", '["`]([^"`]*)["`]' }, }, }, }, }, }, }, }, } ``` ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/plugins/extras/lang/tailwind.lua | 25 +++++++++++--------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/tailwind.lua b/lua/lazyvim/plugins/extras/lang/tailwind.lua index 3c7b3fac..f196983d 100644 --- a/lua/lazyvim/plugins/extras/lang/tailwind.lua +++ b/lua/lazyvim/plugins/extras/lang/tailwind.lua @@ -24,6 +24,20 @@ return { filetypes_include = {}, -- to fully override the default_config, change the below -- filetypes = {} + + -- additional settings for the server, e.g: + -- tailwindCSS = { includeLanguages = { someLang = "html" } } + -- can be addeded to the settings table and will be merged with + -- this defaults for Phoenix projects + settings = { + tailwindCSS = { + includeLanguages = { + elixir = "html-eex", + eelixir = "html-eex", + heex = "html-eex", + }, + }, + }, }, }, setup = { @@ -39,17 +53,6 @@ return { return not vim.tbl_contains(opts.filetypes_exclude or {}, ft) end, opts.filetypes) - -- Additional settings for Phoenix projects - opts.settings = { - tailwindCSS = { - includeLanguages = { - elixir = "html-eex", - eelixir = "html-eex", - heex = "html-eex", - }, - }, - } - -- Add additional filetypes vim.list_extend(opts.filetypes, opts.filetypes_include or {}) end,