fix: conform.nvim option change

This commit is contained in:
xinyangli 2024-11-03 22:03:01 +08:00
parent 78c13f0c98
commit a09d2b94ef
Signed by: xin
SSH key fingerprint: SHA256:UU5pRTl7NiLFJbWJZa+snLylZSXIz5rgHmwjzv8v4oE
2 changed files with 25 additions and 0 deletions

View file

@ -22,4 +22,6 @@
./treesitter.nix ./treesitter.nix
./which-key.nix ./which-key.nix
]; ];
plugins.web-devicons.enable = true;
} }

View file

@ -3,6 +3,25 @@
plugins.conform-nvim = { plugins.conform-nvim = {
enable = true; enable = true;
settings = { settings = {
format_on_save = ''
function(bufnr)
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return
end
if slow_format_filetypes[vim.bo[bufnr].filetype] then
return
end
local function on_format(err)
if err and err:match("timeout$") then
slow_format_filetypes[vim.bo[bufnr].filetype] = true
end
end
return { timeout_ms = 200, lsp_fallback = true }, on_format
end
'';
format_after_save = '' format_after_save = ''
function(bufnr) function(bufnr)
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
@ -43,4 +62,8 @@
taplo taplo
yq yq
]; ];
extraConfigLuaPre = ''
local slow_format_filetypes = { "scala" }
'';
} }