@@ -37,8 +37,8 @@ M.stats = {
37
37
}
38
38
M .me = debug.getinfo (1 , " S" ).source :sub (2 )
39
39
M .me = vim .fn .fnamemodify (M .me , " :p:h:h:h:h" ):gsub (" \\ " , " /" )
40
- --- @type table<string , table< string,string> >
41
- M .topmods = { lazy = { [ M . me ] = M .me } }
40
+ --- @type table<string , string[] >
41
+ M .topmods = { lazy = { M .me } }
42
42
--- @type table<string , string[]>
43
43
M .indexed = { [M .me ] = { " lazy" } }
44
44
M .indexed_unloaded = false
@@ -229,7 +229,9 @@ function M._index(path)
229
229
end
230
230
if topname then
231
231
M .topmods [topname ] = M .topmods [topname ] or {}
232
- M .topmods [topname ][path ] = path
232
+ if not vim .tbl_contains (M .topmods [topname ], path ) then
233
+ table.insert (M .topmods [topname ], path )
234
+ end
233
235
table.insert (M .indexed [path ], topname )
234
236
end
235
237
end )
@@ -257,7 +259,7 @@ function M.find(modname)
257
259
258
260
-- check top-level mods to find the module
259
261
local function _find ()
260
- for _ , toppath in pairs (M .topmods [topmod ] or {}) do
262
+ for _ , toppath in ipairs (M .topmods [topmod ] or {}) do
261
263
for _ , pattern in ipairs (patterns ) do
262
264
local path = toppath .. " /lua/" .. basename .. pattern
263
265
M .stats .find .stat = M .stats .find .stat + 1
0 commit comments