feat(conform): re-enable auto formatting, fix #47 #48
@@ -1,8 +1,3 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
config = {
|
||||
extraConfigLuaPre =
|
||||
@@ -48,6 +43,7 @@
|
||||
enable = true;
|
||||
autoInstall.enable = true;
|
||||
settings = {
|
||||
default_format_opts.lsp_format = "fallback";
|
||||
formatters_by_ft = {
|
||||
html = {
|
||||
__unkeyed-1 = "prettierd";
|
||||
@@ -81,7 +77,7 @@
|
||||
};
|
||||
python = [ "ruff_format" ];
|
||||
lua = [ "stylua" ];
|
||||
nix = [ "nixfmt-rfc-style" ];
|
||||
nix = [ "nixfmt" ];
|
||||
markdown = {
|
||||
__unkeyed-1 = "prettierd";
|
||||
__unkeyed-2 = "prettier";
|
||||
@@ -103,20 +99,61 @@
|
||||
"goimports"
|
||||
"gofmt"
|
||||
];
|
||||
# Auto correct misspelled words
|
||||
# "*" = [ "codebook" ];
|
||||
"_" = [ "trim_whitespace" ];
|
||||
};
|
||||
|
||||
formatters = {
|
||||
terraform_fmt = {
|
||||
command = "${lib.getExe (
|
||||
pkgs.terraform.overrideAttrs (oldAttrs: {
|
||||
meta = lib.recursiveUpdate oldAttrs.meta {
|
||||
license = lib.licenses.gpl3Only;
|
||||
};
|
||||
})
|
||||
)}";
|
||||
};
|
||||
# Disabling because if project has a project limitatiton, then
|
||||
# formatter not working at all
|
||||
# terraform_fmt = {
|
||||
# command = "${lib.getExe (
|
||||
# pkgs.terraform.overrideAttrs (oldAttrs: {
|
||||
# meta = lib.recursiveUpdate oldAttrs.meta {
|
||||
# license = lib.licenses.gpl3Only;
|
||||
# };
|
||||
# })
|
||||
# )}";
|
||||
# };
|
||||
};
|
||||
format_on_save = # Lua
|
||||
''
|
||||
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 = # 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;
|
||||
};
|
||||
};
|
||||
keymaps = [
|
||||
|
||||
Reference in New Issue
Block a user