mhartington/formatter.nvim

lua filetype config for `lua-format` formats wrong buffer after opening new file. (Contains Fix)

silaswaxter opened this issue · 0 comments

Which configuration?
Type (custom or builtin): builtin
Filetype: lua
Formatter: luaformat

Expected behavior

  1. Open a lua file with neovim
  2. Open another a different file (:e <name-of-another-lua-file>
  3. Format it :Format

The text of <name-of-another-lua-file> should be replaced with its formatted text.

Actual behaviour
The text of <name-of-another-lua-file> is replaced with the formatted text of the first opened file.

Additional context
I'm not sure why this is happening. I suspected it had to do with the plugin appending the path of the buffer to the CLI call string, however setting the no_append=true while maintaining the buffer's absolute path as the first argument did not fix the issue.

Setting the default config to use no arguments fixed the issue.
Note: although usage of lua-format says that lua files to format must occur before options, the files can occur before or after; tested with version 1.3.6.