conform.nvim icon indicating copy to clipboard operation
conform.nvim copied to clipboard

bug: isort: error: argument --le/--line-ending: expected one argument

Open Barmaley0 opened this issue 2 years ago • 5 comments

Neovim version (nvim -v)

0.9.5

Operating system/version

Windows 10

Add the debug logs

  • [X] I have set log_level = vim.log.levels.DEBUG and pasted the log contents below.

Log file

conform.log

Describe the bug

When applying isort formatting, an error occurs. Error isort

What is the severity of this bug?

tolerable (can work around it)

Steps To Reproduce

When formatting any file that contains imports. This error occurs.

Expected Behavior

image Here is the config. When mp is pressed, all formatters work except isort.

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

Has anyone encountered this and found a solution?

Barmaley0 avatar May 28 '24 09:05 Barmaley0

I encountered an identical bug, any solution?

vSkyper avatar Jun 26 '24 13:06 vSkyper

Unfortunately no. I will solve this problem later. If you find any solution please write.

Barmaley0 avatar Jun 26 '24 13:06 Barmaley0

Found the cause of the failure. Black and Isort rule each other, and this leads to conflict. Therefore Isort is disabled. This argument can be corrected. I just haven't figured out how yet. You need to specify arguments in conform.nvim.🙄

Barmaley0 avatar Jul 10 '24 17:07 Barmaley0

For now I've been able to get around the conflict by enabling the Isort and black settings. Although the line ending error remained in the ConformInfo manual. But everything works and there are no conflicts. You can also try using { "--profile", "black" } arguments. Now isort is not disabled. Conform works stably.

image

Barmaley0 avatar Jul 11 '24 07:07 Barmaley0

I got the identical error. Fixed it by re-rule the isort command (add one - to args). A little shorter.

  formatters = {
    isort = {
      command = "isort",
      args = {
        "-",
      },
    },
  },

faea726 avatar Jul 18 '24 21:07 faea726