Closed anna328p closed 2 weeks ago
Hey I'm not 100% sure this function is only used here so this might have unexpected changes.
Hey I'm not 100% sure this function is only used here so this might have unexpected changes.
I didn't remove the function, I just changed this one call in lint.lua to call nvim's API instead.
There's one more use of this function in format.lua, which I didn't touch.
Alright, but I would still have to test this.
@anna328p I fixed this in my development fork (will merge after some more features are done), you can try it out and see if it works.
I've been running my fork of guard.nvim for a couple of days and the fix has been working well. I don't know where to find what your development fork.
It's xiaoshihou514/guard.nvim
.
It inclueds all your changes, so it's probably good.
In #150, guard.nvim started writing double newlines to the linter.
guard.nvim adds a newline to the end of each line: https://github.com/nvimdev/guard.nvim/blob/6c3b3cb4e61446fa74ccec1a22f300efe541838a/lua/guard/util.lua#L9-L16
and then nvim's SystemObj:write() adds a newline to the end of every line it writes: https://github.com/neovim/neovim/blob/5331f87f6145f705c73c5c23f365cecb9fbc5067/runtime/lua/vim/_system.lua#L122-L125
which means every newline is doubled, so the linter gets line numbers wrong and keeps complaining about there being too many newlines. This PR replaces the call to
get_prev_lines()
with a direct call to the nvim api so that there are no additional newlines added.