Neovim version (nvim -v)
0.9.4
Operating system/version
macOS 14.0
Add the debug logs
Log file
10:20:26[DEBUG] Running formatters on /Users/jbrown/tmp/2023-10-22/test.rb: { "rubyfmt" }
10:20:26[INFO] Run rubyfmt on /Users/jbrown/tmp/2023-10-22/test.rb
10:20:26[DEBUG] Run command: { "rubyfmt" }
10:20:27[DEBUG] rubyfmt exited with code 1
Describe the bug
When run on a file with invalid syntax, rubyfmt outputs no text and exits with status 1. It looks like conform doesn't understand this, so replaces the buffer contents with the empty string.
Steps To Reproduce
- install rubyfmt and configure it in conform
echo -e "clas Foo\nend" > test.rb
nvim -u repro.lua test.rb
:w
Expected Behavior
Buffer is unchanged and an error is reported
Minimal example file
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,
formatters_by_ft = {
ruby = {"rubyfmt"}
},
format_on_save = {
lsp_fallback = true,
timeout_ms = 500,
},
notify_on_error = true,
})
end,
},
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
Additional context
I think this might just be a matter of changing exit_codes from {0, 1} to {0} in rubyfmt.lua but I don't know enough about this project to say for sure.
Neovim version (nvim -v)
0.9.4
Operating system/version
macOS 14.0
Add the debug logs
log_level = vim.log.levels.DEBUGand pasted the log contents below.Log file
Describe the bug
When run on a file with invalid syntax,
rubyfmtoutputs no text and exits with status 1. It looks likeconformdoesn't understand this, so replaces the buffer contents with the empty string.Steps To Reproduce
echo -e "clas Foo\nend" > test.rbnvim -u repro.lua test.rb:wExpected Behavior
Buffer is unchanged and an error is reported
Minimal example file
Minimal init.lua
Additional context
I think this might just be a matter of changing
exit_codesfrom{0, 1}to{0}inrubyfmt.luabut I don't know enough about this project to say for sure.