-
Notifications
You must be signed in to change notification settings - Fork 276
Description
Neovim version (nvim -v)
NVIM v0.12.0-dev-1801+gd2e445e1bd
Operating system/version
linux 6.17.9
Read debugging tips
- I have read through the debugging tips.
Add the debug logs
- I have set
log_level = vim.log.levels.DEBUGand pasted the log contents below.
Log file
not log contents but error trace:
Error in BufWritePre Autocommands for "*":
Lua callback: ...e/nvim/site/pack/deps/opt/conform/lua/conform/runner.lua:700: timeout has no integer representation
stack traceback:
[C]: in function 'wait'
...e/nvim/site/pack/deps/opt/conform/lua/conform/runner.lua:700: in function 'format_lines_sync'
...e/nvim/site/pack/deps/opt/conform/lua/conform/runner.lua:639: in function 'format_sync'
...are/nvim/site/pack/deps/opt/conform/lua/conform/init.lua:519: in function 'run_cli_formatters'
...are/nvim/site/pack/deps/opt/conform/lua/conform/init.lua:548: in function 'format'
Describe the bug
The int type casting of "timeout" parameter provided to vim.wait(), was removed in neovim (neovim/neovim@bc0635a#diff-3b90e5878221af1767b533577b79f755bdc8b2b5926e879100e0a24433769126L513). So the synchronous formatting now fails.
A possible solution:
-- conform/lua/conform/runner.lua:699
local wait_result, wait_reason = vim.wait(math.floor(remaining), function()
return done
end, 5)The proposed change combined with the earlier if remaining <= 0 then check, preserve the behaviour of the removed type casting on neovim side. Something like local remaining = math.ceil(timeout_ms - (uv.hrtime() / 1e6 - start)) could also be used on line 670, but it would slightly change the previous behaviour.
What is the severity of this bug?
blocking (cannot use plugin)
Steps To Reproduce
Trigger format_lines_sync()
Expected Behavior
The synchronous formatting to work like before the breaking change in neovim.
Minimal example file
No response
Minimal init.lua
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
{
"stevearc/conform.nvim",
config = function()
require("conform").setup({
log_level = vim.log.levels.DEBUG,
-- add your config here
})
end,
},
-- add any other plugins here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else hereAdditional context
No response