fix: types (#1344)

This commit is contained in:
yetone
2025-02-22 23:24:20 +08:00
committed by GitHub
parent 0704a5820a
commit b04bffa441
23 changed files with 493 additions and 328 deletions

View File

@@ -42,10 +42,11 @@ end
---@param patterns string[]|string
function M.detectors.pattern(buf, patterns)
patterns = type(patterns) == "string" and { patterns } or patterns
local patterns_ = type(patterns) == "string" and { patterns } or patterns
---@cast patterns_ string[]
local path = M.bufpath(buf) or vim.uv.cwd()
local pattern = vim.fs.find(function(name)
for _, p in ipairs(patterns) do
for _, p in ipairs(patterns_) do
if name == p then return true end
if p:sub(1, 1) == "*" and name:find(vim.pesc(p:sub(2)) .. "$") then return true end
end