---@type LazySpec
return {
  {
    "AstroNvim/astrolsp",
    ---@type AstroLSPOpts
    opts = function(_, opts)
      return vim.tbl_deep_extend("force", opts, {
        ---@diagnostic disable: missing-fields
        config = {
          tailwindcss = {
            root_dir = function(fname)
              local root_pattern = require("lspconfig").util.root_pattern(
                "tailwind.config.cjs",
                "tailwind.config.js",
                "tailwind.config.ts",
                "postcss.config.js",
                "config/tailwind.config.js"
              )
              return root_pattern(fname)
            end,
            settings = {
              tailwindCSS = {
                classAttributes = {
                  "class",
                  "className",
                  "ngClass",
                  "classList",
                },
                experimental = {
                  classRegex = {
                    { "cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]" },
                    { "cx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)" },
                    {
                      "tw`([^`]*)",
                      'tw="([^"]*)',
                      'tw={"([^"}]*)',
                      "tw\\.\\w+`([^`]*)",
                      "tw\\(.*?\\)`([^`]*)",
                    },
                  },
                },
                includeLanguages = {
                  typescript = "javascript",
                  typescriptreact = "javascript",
                },
                emmetCompletions = false,
                validate = true,
                lint = {
                  cssConflict = "warning",
                  invalidApply = "error",
                  invalidConfigPath = "error",
                  invalidScreen = "error",
                  invalidTailwindDirective = "error",
                  invalidVariant = "error",
                  recommendedVariantOrder = "warning",
                },
              },
            },
          },
        },
      })
    end,
  },
  {
    "nvim-treesitter/nvim-treesitter",
    optional = true,
    opts = function(_, opts)
      if opts.ensure_installed ~= "all" then
        opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "css" })
      end
    end,
  },
  {
    "WhoIsSethDaniel/mason-tool-installer.nvim",
    optional = true,
    opts = function(_, opts)
      opts.ensure_installed =
        require("astrocore").list_insert_unique(opts.ensure_installed, { "tailwindcss-language-server" })
    end,
  },
}
