From 875cd4cefa2e814fcda527de3864041ef65c08a4 Mon Sep 17 00:00:00 2001 From: jasmine Date: Mon, 23 Dec 2024 08:32:36 +0800 Subject: [PATCH] fix conform.nix --- config/plugins/lsp/conform.nix | 35 ++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/config/plugins/lsp/conform.nix b/config/plugins/lsp/conform.nix index baeed3e..dfaa155 100644 --- a/config/plugins/lsp/conform.nix +++ b/config/plugins/lsp/conform.nix @@ -1,4 +1,8 @@ -{pkgs, ...}: { +{ + lib, + pkgs, + ... +}: { plugins.conform-nvim = { enable = true; @@ -8,25 +12,32 @@ lspFallback = true; timeoutMs = 500; }; + # Receive notificaton when a formatter errors. + notifyOnError = true; # Map of filetype to formatters. - formattersByFt = { + formatters_by_ft = { c = ["clang-format"]; haskell = ["stylish-haskell"]; lua = ["stylua"]; nix = ["alejandra"]; }; - # Receive notificaton when a formatter errors. - notifyOnError = true; + # Install our formatters + formatters = { + alejandra = { + command = lib.getExe pkgs.alejandra; + }; + clang-format = { + command = lib.getExe' pkgs.clang-tools "clang-format"; + }; + stylish-haskell = { + command = lib.getExe pkgs.stylish-haskell; + }; + stylua = { + command = lib.getExe pkgs.stylua; + }; + }; }; }; - - # Install our formatters. - extraPackages = with pkgs; [ - alejandra - clang-tools - stylish-haskell - stylua - ]; }