Closed tanj closed 3 months ago
I couldn't reproduce this in Linux. It may very well be the default behavior of isort on Windows. Either way conform calls isort with some default arguments nothing more. Here
If I run isort directly on the file (not through stdin/stdout) then no extra line at the end occurs. If, however, I pipe the input through and back out via stdin/stdout then the line endings of the file get changed from \n
to \r\n
. I wonder if this may be a bug in neovim where if the replacement text has \r\n
line endings in a \n
buffer it ends up with the extra \n
at the end of the file.
It can also be an intended effect with the fixeol setting. You can try turning it off.
I added a simple dos2unix formatter to my formatter pipeline and it fixes this. I created a pull request if it is wanted. #383
Format pipline:
python = { 'isort', 'dos2unix' },
this fixes the issue for me.
Neovim version (nvim -v)
NVIM v0.10.0-dev-2752+g35239e977
Operating system/version
Windows 11 Pro
Add the debug logs
log_level = vim.log.levels.DEBUG
and pasted the log contents below.Log file
Describe the bug
When saving a python file with
isort
as one of the formatters the file will end up with an extra newline (\n
) at the end of the file.What is the severity of this bug?
minor (annoyance)
Steps To Reproduce
print("hello")
:wq
:w
Expected Behavior
No extra newline added to file
Minimal example file
example input file
xxd
after isort run by conform
xxd
Minimal init.lua
Additional context
No response