lazy.nvim icon indicating copy to clipboard operation
lazy.nvim copied to clipboard

`build.lua` has no access to plugin dir

Open bugabinga opened this issue 11 months ago • 0 comments

https://github.com/folke/lazy.nvim/blob/83493db50a434a4c5c648faf41e2ead80f96e478/lua/lazy/manage/task/plugin.lua#L50

From reading the code, I think this line has the issue, that, if a plugin specifies a build.lua file, it gets sourced into the current neovim lua runtime, thereby sharing its CWD. The build file typically wants a CWD equal to plugin dir. That is already the case if the build property is a script or a function (via the plugin spec parameter).

Furthermore, if the build is a lua file or a function, it does not seem to run async. https://github.com/folke/lazy.nvim/blob/83493db50a434a4c5c648faf41e2ead80f96e478/lua/lazy/manage/task/plugin.lua#L62

If this is correct, what would I need to change to run build.lua in plugin.dir and make it and the function variant async?

  • coroutines?
  • vim.uv.new_thread?
  • spawn new nvim --headless -c ?

bugabinga avatar Mar 20 '24 15:03 bugabinga