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