-
Notifications
You must be signed in to change notification settings - Fork 6
Plugin breaks with function in table #8
Description
Hey! I started using your plugin today and it works great, however I believe I've discovered a bug. I'm not sure if this is something you're actually able to fix on your side, but here's an example snipped from my configuration for conform which triggers the error:
local prettier = function(bufnr)
if require("conform").get_formatter_info("prettier", bufnr).available then
return { "prettier" }
else
return {}
end
end
require("conform").setup({
formatters_by_ft = {
javascript = prettier,
typescript = prettier,
vue = prettier,
},
})It throws this error on startup:
Error detected while processing BufEnter Autocommands for "*":
Error executing vim.schedule lua callback: ...ed/mason-conform.nvim/lua/mason-conform/auto_install.lua:10: bad argument #1 to 'pairs' (table expected, got function)
stack traceback:
[C]: in function 'pairs'
...ed/mason-conform.nvim/lua/mason-conform/auto_install.lua:10: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
[C]: in function 'wait'
...oload/plugged/nvim-tree.lua/lua/nvim-tree/git/runner.lua:171: in function '_wait'
...oload/plugged/nvim-tree.lua/lua/nvim-tree/git/runner.lua:221: in function 'run'
...utoload/plugged/nvim-tree.lua/lua/nvim-tree/git/init.lua:243: in function 'load_project_status'
...ad/plugged/nvim-tree.lua/lua/nvim-tree/explorer/init.lua:49: in function '_load'
...ad/plugged/nvim-tree.lua/lua/nvim-tree/explorer/init.lua:41: in function 'new'
...im/autoload/plugged/nvim-tree.lua/lua/nvim-tree/core.lua:20: in function 'init'
.../nvim-tree.lua/lua/nvim-tree/actions/root/change-dir.lua:88: in function 'f'
.../nvim-tree.lua/lua/nvim-tree/actions/root/change-dir.lua:77: in function 'force_dirchange'
...ig/nvim/autoload/plugged/nvim-tree.lua/lua/nvim-tree.lua:117: in function <...ig/nvim/autoload/plugged/nvim-tree.lua/lua/nvim-tree.lua:105>
If i replace the function in the table with just {"prettier"} the issue goes away. Also, if I call the function like prettier() instead of just putting the function object in the table, I believe the issue also goes away. Now that I'm using this plugin, I don't really need to worry about needing this specific function, but it may come up in the future for others so I figured I'd document it here at least. Thanks for your work, and let me know if you need any more info