[options] Properly handle dev.path as a function

This commit is contained in:
Arnaud TANGUY 2025-01-30 11:43:00 +01:00
parent d8f26efd45
commit ae66638f72
No known key found for this signature in database
GPG key ID: 670FEE9ECBA397FB
2 changed files with 4 additions and 2 deletions

View file

@ -679,7 +679,7 @@ will be added to the plugins spec.
dev = {
-- Directory where you store your local plugin projects. If a function is used,
-- the plugin directory (e.g. `~/projects/plugin-name`) must be returned.
---@type string | fun(plugin: LazyPlugin): string
---@type string | fun(): string
path = "~/projects",
---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub
patterns = {}, -- For example {"folke"}

View file

@ -69,7 +69,7 @@ M.defaults = {
dev = {
-- Directory where you store your local plugin projects. If a function is used,
-- the plugin directory (e.g. `~/projects/plugin-name`) must be returned.
---@type string | fun(plugin: LazyPlugin): string
---@type string | fun(): string
path = "~/projects",
---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub
patterns = {}, -- For example {"folke"}
@ -286,6 +286,8 @@ function M.setup(opts)
M.options.root = Util.norm(M.options.root)
if type(M.options.dev.path) == "string" then
M.options.dev.path = Util.norm(M.options.dev.path)
else
M.options.dev.path = Util.norm(M.options.dev.path())
end
M.options.lockfile = Util.norm(M.options.lockfile)
M.options.readme.root = Util.norm(M.options.readme.root)