Skip to content

dotnet format logs no change nessesary with dotnet #327

Description

@Rikthepixel

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions