stevearc / conform.nvim

Lightweight yet powerful formatter plugin for Neovim
MIT License
2.58k stars 136 forks source link

bug: In windows neovim formatting any file with conform adds U+000c character at beginning of file. #404

Open doesDeveloper opened 1 month ago

doesDeveloper commented 1 month ago

Neovim version (nvim -v)

v0.10.0-dev-3122+ga0a189a8e

Operating system/version

Windows 11

Add the debug logs

Log file

5:24:02[ERROR] Formatter 'stylua' error: error: could not format from stdin: failed to format from stdin: error parsing: error occurred while tokenizing: unexpected character at line 1, column 1

      15:24:03[ERROR] Formatter 'stylua' error: error: could not format from stdin: failed to format from stdin: error parsing: error occurred while tokenizing: unexpected character  at line 1, column 1

      15:24:03[ERROR] Formatter 'stylua' error: error: could not format from stdin: failed to format from stdin: error parsing: error occurred while tokenizing: unexpected character  at line 1, column 1

      15:24:07[ERROR] Formatter 'stylua' error: error: could not format from stdin: failed to format from stdin: error parsing: error occurred while tokenizing: unexpected character  at line 1, column 1

      15:24:10[ERROR] Formatter 'stylua' error: error: could not format from stdin: failed to format from stdin: error parsing: error occurred while tokenizing: unexpected character  at line 1, column 1

Describe the bug

On formatting any file with conform.nvim it adds special character at beginning of each file. Which breaks some file from formatting again.

What is the severity of this bug?

breaking (some functionality is broken)

Steps To Reproduce

install any formatter. try to format it with conform.

Expected Behavior

No special character at beginning of file.

Minimal example file

No response

Minimal init.lua

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  {
    "stevearc/conform.nvim",
    config = function()
      require("conform").setup({
        log_level = vim.log.levels.DEBUG,
        -- add your config here
      })
    end,
  },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

Additional context

No response

Barmaley0 commented 1 month ago

Hello. Have you resolved this issue?