Open
Description
Neovim version (nvim -v)
0.10.2
Operating system/version
macos 15
Read debugging tips
- I have read through the debugging tips.
Add the debug logs
- I have set
log_level = vim.log.levels.DEBUG
and pasted the log contents below.
Log file
... filepath
[error] 1 |
[error] > 2 | <input css 1>
[error] | ^
[error] 3 | 13:5 ✖ Unknown word CssSyntaxError
[error] 4 |
[error] 5 | 1 problem (1 error, 0 warnings)
Describe the bug
When theres a syntax error, the error gets written to the buffer despite the exit code being 2 and me specifying 0,1.
What is the severity of this bug?
breaking (some functionality is broken)
Steps To Reproduce
open this as scss
nav {
ul {
margin: 0;
padding: 0;
list-style: none;
}
li { display: inline-block; }
a {
display: block;
padding: 6px 12px;
text-decoration: none;
}
}
then delete a bracket. Then try to format, the error gets written into the buffer
Expected Behavior
It should not modify the buffer because the exit code was 2.
Minimal example file
prettier = {
command = format_utils.from_node_modules("prettier"),
args = function(self, ctx)
local args = { "--stdin-filepath", "$FILENAME" }
-- Get the current buffer's shiftwidth
local shiftwidth = vim.bo.shiftwidth
-- Determine if tabs or spaces are being used
local use_tabs = vim.bo.expandtab == false
-- Add indentation options
table.insert(args, "--use-tabs")
table.insert(args, tostring(use_tabs))
table.insert(args, "--tab-width")
table.insert(args, tostring(shiftwidth))
-- Add config path if specified
local config_path = format_utils.find_config_file("prettier", prettier_config_patterns, ctx)
if config_path then
table.insert(args, "--config")
table.insert(args, config_path)
end
return args
end,
stdin = true,
exit_codes = { 0, 1 },
cwd = function()
return file_utils.find_closest_node_modules_to_current_file()
end,
condition = function(_, ctx)
return format_utils.formatter_condition("prettier", prettier_config_patterns, ctx)
end,
},
Minimal init.lua
No response
Additional context
No response