Open
Description
Most editors can invoke an external command to format a file, but they don't expect the file to change out from under them.
The simplest would be to support a --stdin
flag, that would read the file in stdin, and output the formatted file to stdout.
FWIW, I was able to get it to work with Neovim & conform.vim using the tempfile feature. I'm not sure how many other editors make that possible, though.
formatters = {
ruboclean = {
condition = function(ctx)
return vim.fs.basename(ctx.filename) ~= ".rubocop.yml"
end,
command = "ruboclean",
args = { "$FILENAME", "--preserve-comments", "--preserve-paths", "--silent" },
stdin = false,
},
},
formatters_by_ft = {
yaml = { "ruboclean" }
}
Metadata
Metadata
Assignees
Labels
No labels