stevearc / conform.nvim

Lightweight yet powerful formatter plugin for Neovim
MIT License
3.02k stars 156 forks source link

How to configure isort to split imports #513

Closed Barmaley0 closed 1 month ago

Barmaley0 commented 1 month ago

Neovim version (nvim -v)

0.9.5

Operating system/version

Windows 10

Add the debug logs

Log file

Not log file

Describe the bug

Not bug

What is the severity of this bug?

minor (annoyance)

Steps To Reproduce

Hello. Can you tell me how to make a setting to separate imports? At the moment it does not work. image

Expected Behavior

There should be a division by packages before image after image

Minimal example file

Tell me what I'm doing wrong?

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

How to set it up?

Barmaley0 commented 1 month ago

image

stevearc commented 1 month ago

You need to pass the sections in as an argument, presumably. I don't know where you got the idea to use the syntax you are using, but conform does not take arbitrary fields in the definition of the formatter. You can see the exact fields that are supported in the options documentation.

Barmaley0 commented 1 month ago

I passed it as an argument but it doesn't work.

stevearc commented 1 month ago

Please check out the new docs I have written to aid with debugging: https://github.com/stevearc/conform.nvim/blob/master/doc/debugging.md