fix(conform): disable slow formatters in before_save hook, and format them after save
This commit is contained in:
@@ -124,34 +124,33 @@
|
||||
return
|
||||
end
|
||||
|
||||
-- if slow_format_filetypes[vim.bo[bufnr].filetype] then
|
||||
-- return
|
||||
-- end
|
||||
if slow_format_filetypes[vim.bo[bufnr].filetype] then
|
||||
return
|
||||
end
|
||||
|
||||
local function on_format(err)
|
||||
return
|
||||
-- if err and err:match("timeout$") then
|
||||
-- slow_format_filetypes[vim.bo[bufnr].filetype] = true
|
||||
-- end
|
||||
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 = # Lua
|
||||
# ''
|
||||
# function(bufnr)
|
||||
# if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||
# return
|
||||
# end
|
||||
#
|
||||
# if not slow_format_filetypes[vim.bo[bufnr].filetype] then
|
||||
# return
|
||||
# end
|
||||
#
|
||||
# return { lsp_fallback = true }
|
||||
# end
|
||||
# '';
|
||||
format_after_save = # Lua
|
||||
''
|
||||
function(bufnr)
|
||||
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||
return
|
||||
end
|
||||
|
||||
if not slow_format_filetypes[vim.bo[bufnr].filetype] then
|
||||
return
|
||||
end
|
||||
|
||||
return { lsp_fallback = true }
|
||||
end
|
||||
'';
|
||||
log_level = "warn";
|
||||
notify_on_error = true;
|
||||
notify_no_formatters = false;
|
||||
|
||||
Reference in New Issue
Block a user