Closed luckasRanarison closed 2 months ago
This would be really helpful for already supported languages too.
For example, when using tailwind with clsx
, the plugin doesn't detect tailwind classes inside of the clsx()
function. I used the following configuration to enable the lsp for clsx and would love to be able to do something similar here.
require'lspconfig'.tailwindcss.setup{
-- ...
settings = {
experimental = {
classRegex = { "clsx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)" }, -- regex taken from https://www.npmjs.com/package/clsx#tailwind-support
}
}
-- ...
}
@Confuze Sorry for the late reply.
Lua patterns have been introduced in #31. Although your use case can be implemented using plain treesitter queries.
I'll make a list of css class libraries like clsx and add them directly to the plugin. But for the moment, I've shown an example using Lua patterns for capturing clsx in the updated README :)
update: clsx support has been added.
Add the ability to use regex when classes cannot be obtained through treesitter. (#25)
It's currently blocked due to the lack of APIs for searching pattern and retrieving both start and end positions.