Open TabulateJarl8 opened 1 month ago
Thanks for the report :smile:
I'm not sure if this is something you're actually able to fix on your side
I did not know that you could provide a function to conform in this manner.
Now that I'm using this plugin, I don't really need to worry about needing this specific function
Yea that is my take on this issue as well. Configuring a function like this with conform does not really make sense in the context of this plugin, at least not to me.
I'd say this is very low on my priority list right now.
I have stumbled upon this as well when selecting one of multiple formatters, followed by running more formatters.
With the release of 7.0.0, conform.nvim switched to a new configuration format which deprecates the nested table configuration style for running one formatter out of a pool and subsequently another formatter:
require("conform").setup({
formatters_by_ft = {
markdown = { { "prettier", "prettierd" }, "cbfmt" },
},
})
This produces a warning with the new version. The manual instead recommends the following code recipe:
---@param bufnr integer
---@param ... string
---@return string
local function first(bufnr, ...)
local conform = require("conform")
for i = 1, select("#", ...) do
local formatter = select(i, ...)
if conform.get_formatter_info(formatter, bufnr).available then
return formatter
end
end
return select(1, ...)
end
require("conform").setup({
formatters_by_ft = {
markdown = function(bufnr)
return { first(bufnr, "prettierd", "prettier"), "cbfmt" }
end,
},
})
This seems to pose the same issue again.
I agree that it's not a priority issue but with the documentation recommending this way of configuration I think more reports are going to appear which stumble upon the same error.
With the release of 7.0.0, conform.nvim switched to a new configuration format
Thanks for the heads up, we should definitely support this going forward then.
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:
It throws this error on startup:
If i replace the function in the table with just
{"prettier"}
the issue goes away. Also, if I call the function likeprettier()
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