mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-08-28 13:58:12 +02:00
fix: add more accurate way to detect tailwindcss inside node_modules
This commit is contained in:
parent
c540b9ada3
commit
1563e3ab14
1 changed files with 11 additions and 8 deletions
|
@ -18,18 +18,21 @@ return {
|
||||||
opts = {
|
opts = {
|
||||||
servers = {
|
servers = {
|
||||||
tailwindcss = {
|
tailwindcss = {
|
||||||
-- exclude a filetype from the default_config
|
|
||||||
filetypes_exclude = { "markdown" },
|
|
||||||
-- add additional filetypes to the default_config
|
|
||||||
filetypes_include = {},
|
|
||||||
-- to fully override the default_config, change the below
|
|
||||||
-- filetypes = {}
|
|
||||||
root_dir = function(fname)
|
root_dir = function(fname)
|
||||||
local node_modules = vim.fs.dirname(vim.fs.find("node_modules", { path = fname, upward = true })[1])
|
local node_modules = vim.fs.find("node_modules", { path = fname, upward = true })[1]
|
||||||
|
local root = vim.fs.dirname(node_modules)
|
||||||
if not node_modules then
|
if not node_modules then
|
||||||
return nil
|
return nil
|
||||||
else
|
else
|
||||||
return node_modules
|
local tailwind_path = node_modules .. "/tailwindcss"
|
||||||
|
print("TailwindCSS root path: " .. tailwind_path)
|
||||||
|
print(vim.inspect(vim.fn.isdirectory(tailwind_path)))
|
||||||
|
|
||||||
|
if vim.fn.isdirectory(tailwind_path) ~= 0 then
|
||||||
|
return root
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue