Closed tigion closed 1 month ago
I did some more testing. If I use the function directly, it works:
...
---@param plugin LazyPlugin
---@return string
local function get_path1(plugin)
return '~/projects/neovim'
end
---@return string
local function get_path2()
return '~/projects/neovim'
end
---@type LazyConfig
local opts = {
dev = {
path = get_path1, -- Don't work (path get a function)
path = get_path2(), -- Works (path get a string)
path = '~/projects/neovim', -- Works (path get a string)
},
}
require('lazy').setup(spec, opts)
well the get_path2()
isn't actually a function but a string. The function gets evaluated when setting the value and lazy doesn't even know nor care where it came from
Yes, it was a step in my debugging process. :)
I think I found it:
---@param plugin LazyPlugin
---@return string
local function get_path(plugin)
return '~/projects/neovim/' .. plugin.name -- <-- I now must add the plugin name here
end
---@type LazyConfig
local opts = {
dev = {
path = get_path, -- Now works (path get a function)
path = '~/projects/neovim', -- Works (path get a string)
},
}
are you sure this worked in the past? because by looking at the commit history it seems like this didn't change recently
perhaps you could open a pull request to clarify the docs on this and close this issue
are you sure this worked in the past?
That's a good question. I should have asked myself that earlier. 🫣
After researching the history of the repositories, I think it has always been like this and the description is simply misleading.
A pull request to clarify the docs is a good Idea.
Did you check docs and existing issues?
Neovim version (nvim -v)
0.10.1
Operating system/version
macOS 14.6.1
Describe the bug
The option for the path to local plugins no longer works with a function.
A simple example:
I have a function that searches in different directories and returns the first hit, but this no longer works: