feat: builtin - lua package reloader (#132)

This commit is contained in:
Senghan Bright
2020-10-04 09:08:05 -04:00
committed by GitHub
parent ce66c1f78c
commit 054bd34498
2 changed files with 64 additions and 0 deletions
+24
View File
@@ -331,4 +331,28 @@ function make_entry.gen_from_tagfile(opts)
end
end
function make_entry.gen_from_packages(opts)
opts = opts or {}
local make_display = function(module_name)
local path = package.searchpath(module_name, package.path) or ""
local display = string.format("%-" .. opts.column_len .. "s : %s", module_name, vim.fn.fnamemodify(path, ":~:."))
return display
end
return function(module_name)
local entry = {
valid = module_name ~= "",
entry_type = make_entry.types.GENERIC,
value = module_name,
ordinal = module_name,
}
entry.display = make_display(module_name)
return entry
end
end
return make_entry