Agents run stylua/biome/rustfmt themselves, and a save-time reformat races their in-flight writes to the same buffer. Timeout and LSP fallback move to default_format_opts so <leader>fm (NvChad's binding) keeps the same behaviour; conform now lazy-loads on first use. Drops the /contrib/ skip — explicit invocation is already the opt-in. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
32 lines
838 B
Lua
32 lines
838 B
Lua
local options = {
|
|
formatters_by_ft = {
|
|
lua = { "stylua" },
|
|
rust = { "rustfmt", require_cwd = true },
|
|
-- biome-check runs format + organize-imports + safe lint fixes in one pass
|
|
javascript = { "biome-check" },
|
|
typescript = { "biome-check" },
|
|
json = { "biome-check" },
|
|
solidity = { "forge_fmt" },
|
|
nix = { "nixfmt" },
|
|
toml = { "taplo" },
|
|
elixir = { "mix" },
|
|
cpp = { "clang-format" },
|
|
kotlin = { "ktlint" },
|
|
},
|
|
formatters = {
|
|
biome = { require_cwd = true },
|
|
rustfmt = {
|
|
args = { "--edition", "2024" },
|
|
},
|
|
},
|
|
|
|
-- No format-on-save: agents run these formatters themselves, and a save-time
|
|
-- reformat races their in-flight writes. Format on demand with <leader>fm.
|
|
default_format_opts = {
|
|
timeout_ms = 1000,
|
|
lsp_format = "fallback",
|
|
},
|
|
}
|
|
|
|
return options
|