You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
local conform = {
"stevearc/conform.nvim",
event = "BufWritePost",
opts = {
formatters_by_ft = {
-- TODO: replace them with language servers if the later is better.
html = { "prettier" },
css = { "prettier" },
javascript = { "prettier" },
typescript = { "prettier" },
json = { "prettier" },
yaml = { "prettier" },
markdown = { "prettier" },
python = {
"ruff_fix", -- To fix auto-fixable lint errors.
"ruff_format", -- To run the Ruff formatter.
}, -- Although ruff is a ls, the official suggests using these formatters
toml = {}, -- TOMP formatter is provided by taplo ls.
lua = { "stylua" }, -- lua_ls' primitive formatter is disabled
},
format_on_save = {
-- These options will be passed to conform.format()
timeout_ms = 500,
lsp_format = "fallback", -- use vim.lsp.buf.format() when no formatter available.
},
formatters = {
-- Drop `--fix` from ruff_fix formatter in favor of pyproject.toml
ruff_fix = {
args = {
"check",
"--force-exclude",
"--exit-zero",
"--no-cache",
"--stdin-filename",
"$FILENAME",
"-",
},
stdin = true,
},
},
},
}
And when I save any python file, the file content is overwrote as "All checks passed!" or some errors. To my surprise, the origin ruff_fix formatter works well anyway. But how?
The text was updated successfully, but these errors were encountered:
From my understanding, ruff check --fix outputs either "All checks passed!" or some errors like this:
So I tried to customize the ruff_fix formatter like this:
And when I save any python file, the file content is overwrote as "All checks passed!" or some errors. To my surprise, the origin ruff_fix formatter works well anyway. But how?
The text was updated successfully, but these errors were encountered: