fix: dont return init.lua in lsmod

This commit is contained in:
Folke Lemaitre 2022-11-26 13:57:17 +01:00
parent 359c260911
commit 413dd5b112
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 1 additions and 1 deletions

View File

@ -135,7 +135,7 @@ end
---@param fn fun(modname:string, modpath:string) ---@param fn fun(modname:string, modpath:string)
function M.lsmod(root, fn) function M.lsmod(root, fn)
M.ls(root, function(path, name, type) M.ls(root, function(path, name, type)
if type == "file" and name:sub(-4) == ".lua" then if type == "file" and name:sub(-4) == ".lua" and name ~= "init.lua" then
fn(name:sub(1, -5), path) fn(name:sub(1, -5), path)
elseif type == "directory" and vim.loop.fs_stat(path .. "/init.lua") then elseif type == "directory" and vim.loop.fs_stat(path .. "/init.lua") then
fn(name, path .. "/init.lua") fn(name, path .. "/init.lua")