fix: support /nix/store links

This commit is contained in:
Marc Jakobi
2024-06-19 17:48:15 +02:00
parent ed1dfca4c6
commit fa625dd864
2 changed files with 23 additions and 4 deletions
+6 -2
View File
@@ -59,9 +59,13 @@ local function import_spec(spec, result)
ty = ty or vim.uv.fs_stat(path).type
if not name then
break
elseif ty == "file" or ty == "directory" then
local submodname = vim.fn.fnamemodify(name, ":r")
-- XXX: "link" is required to support Nix.
-- It seems to break in tests with with local symlinks
elseif (ty == "file" or ty == "link") and name:sub(-4) == ".lua" then
local submodname = name:sub(1, -5)
import_modname(modname .. "." .. submodname, result)
elseif ty == "directory" and vim.uv.fs_stat(vim.fs.joinpath(path, "init.lua")) then
import_modname(modname .. "." .. name, result)
end
end
end