This commit is contained in:
2026-06-19 17:07:43 +03:00
parent 5b814774cd
commit c17ed13e2a
6 changed files with 37 additions and 79 deletions

View File

@@ -1,30 +1,4 @@
local utils = {}
function utils.root_markers_with_field(root_files, new_names, field, fname)
local path = vim.fn.fnamemodify(fname, ':h')
local found = vim.fs.find(new_names, { path = path, upward = true })
for _, f in ipairs(found or {}) do
-- Match the given `field`.
for line in io.lines(f) do
if line:find(field) then
root_files[#root_files + 1] = vim.fs.basename(f)
break
end
end
end
return root_files
end
function utils.insert_package_json(root_files, field, fname)
return utils.root_markers_with_field(
root_files,
{ 'package.json', 'package.json5' },
field,
fname
)
end
local utils = require('utils')
---@brief
--- https://github.com/tailwindlabs/tailwindcss-intellisense