mhartington / formatter.nvim

MIT License
1.33k stars 140 forks source link

dotnet format logs `no change nessesary with dotnet` #327

Open Rikthepixel opened 5 months ago

Rikthepixel commented 5 months ago

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?

protomorphine commented 1 month ago

have the same issue with latest formatter.nvim