Skip to content

Commit

Permalink
fix: conform config
Browse files Browse the repository at this point in the history
  • Loading branch information
fbosch committed Jul 29, 2024
1 parent 23c8c89 commit 62099d3
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions .config/nvim/lua/plugins/editor/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ return {
config = function()
local group = vim.api.nvim_create_augroup("Conform", {})
local conform = require("conform")
local web_formatters = { { "prettierd", "prettier", "biome format" } }
local web_formatters = { "prettierd", "prettier", "biome format", stop_after_first = true }
conform.setup({
default_format_options = {
timeout = 1000,
lsp_format = "fallback",
},
format_on_save = {
lsp_fallback = true,
quiet = true,
async = false,
},
formatters_by_ft = {
html = web_formatters,
Expand All @@ -88,20 +90,23 @@ return {
typescript = web_formatters,
typescriptreact = web_formatters,
["typescript.tsx"] = web_formatters,
fish = { { "fish_indent" } },
lua = { { "stylua" } },
markdown = { { "prettierd", "prettier" } },
mdx = { { "biome format" } },
json = { { "biome format" } },
rust = { { "cargo fmt -- --force" } },
yaml = { { "prettierd", "prettier" } },
fish = { "fish_indent" },
lua = { "stylua" },
markdown = { "prettierd", "prettier", stop_after_first = true },
mdx = { "biome format" },
json = { "biome format" },
rust = { "cargo fmt -- --force" },
yaml = { "prettierd", "prettier", stop_after_first = true },
},
})

vim.api.nvim_create_autocmd("BufWritePre", {
group = group,
callback = function()
conform.format()
conform.format({
lsp_format = "fallback",
quiet = true,
})
end,
})
end,
Expand Down

0 comments on commit 62099d3

Please sign in to comment.