mhartington/formatter.nvim

dotnet format logs `no change nessesary with dotnet`

Rikthepixel opened this issue · 7 comments

Which configuration?

Type (custom or builtin): builtin
Filetype: cs
Formatter: dotnetformat

Configuration(s):

Builtin dotnet format

{
  logging = true,
  log_level = vim.log.levels.DEBUG,
  filetype = {
    cs = {
      require("formatter.filetypes.cs").dotnetformat
    },
  },
}

Attempted custom configuration with ignore_exitcode and no_append

{
  logging = true,
  log_level = vim.log.levels.DEBUG,
  filetype = {
    cs = {
      function()
        return {
          exe = "dotnet",
          args = {
            "format",
            "whitespace",
            "--include",
          },
          no_append = true,
          ignore_exitcode = true,
          stdin = false,
        }
      end,
    },
  },
}

Expected behavior

When the formatter is ran the contents of the file should be changed the and result in the same changes as running dotnet format whitespace --include .\Test.cs in the commandline.

Initial file content

if(true){  Console.WriteLine();
}

File content after format

if (true)
{
    Console.WriteLine();
}

Actual behaviour

When the formatter is ran, formatter.nvim logs that nothing has changed. When checking the tempfile it does seem that it hasn't changed. Though when manually dotnet format whitespace --include .\Test.cs the it does get formatted correctly.

Additional context

formatter.nvim logs no change nessesary with dotnet. Which seems to mean that the tempfile hasn't changed. I tried to modify the plugin to try to debug it, though it just confirmed what the log said. Maybe the formatter.nvim is reading the file out before dotnet format is finished formatting?

have the same issue with latest formatter.nvim