diff --git a/homes/modules/programs/neovim/lua/plugins/format.lua b/homes/modules/programs/neovim/lua/plugins/format.lua index 800fde7..636008b 100644 --- a/homes/modules/programs/neovim/lua/plugins/format.lua +++ b/homes/modules/programs/neovim/lua/plugins/format.lua @@ -58,7 +58,18 @@ return { formatters_by_ft = { lua = nixCats("lang.lua.format") and { "stylua" } or nil, nix = nixCats("lang.nix.format") and { "alejandra" } or nil, - rust = nixCats("lang.rust.format") and { "rustfmt", lsp_format = "fallback" } or nil, + rust = (function() + if not nixCats("lang.rust.format") then + return nil + end + local formatters = {} + if nixCats("lang.rust.formatters.leptos") then + table.insert(formatters, "leptosfmt") + end + table.insert(formatters, "rustfmt") + formatters.lsp_format = "fallback" + return formatters + end)(), haskell = nixCats("lang.haskell.format") and { "ormolu" } or nil, proto = nixCats("lang.protobuf.format") and { "buf" } or nil, toml = nixCats("lang.toml.format") and { "taplo" } or nil, diff --git a/homes/modules/programs/neovim/nixcats.nix b/homes/modules/programs/neovim/nixcats.nix index 9ea2a99..e848ce9 100644 --- a/homes/modules/programs/neovim/nixcats.nix +++ b/homes/modules/programs/neovim/nixcats.nix @@ -65,6 +65,9 @@ in { lsp = [cargo mpkgs.rust-analyzer]; # nightly rustfmt has nicer features :3 format = [(rustfmt.override {asNightly = true;})]; + formatters = { + leptos = [leptosfmt]; + }; }; zig = { lsp = [zls]; @@ -278,6 +281,9 @@ in { rust.lsp = true; rust.format = true; + rust.formatters = { + leptos = true; + }; zig.lsp = true; zig.format = true;