From b24999300baf3b22a8037a4bb24c0272b9046a96 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Thu, 27 Mar 2025 20:10:30 +0100 Subject: [PATCH] language/hcl: migrate to conform/nvim-lint --- modules/plugins/languages/hcl.nix | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/modules/plugins/languages/hcl.nix b/modules/plugins/languages/hcl.nix index e340e74d..3a3db782 100644 --- a/modules/plugins/languages/hcl.nix +++ b/modules/plugins/languages/hcl.nix @@ -6,6 +6,7 @@ }: let inherit (builtins) attrNames; inherit (lib.options) mkEnableOption mkOption; + inherit (lib.meta) getExe; inherit (lib.modules) mkIf mkMerge; inherit (lib.types) package bool enum; inherit (lib.nvim.types) mkGrammarOption; @@ -30,14 +31,6 @@ formats = { hclfmt = { package = pkgs.hclfmt; - nullConfig = '' - table.insert( - ls_sources, - null_ls.builtins.formatting.hclfmt.with({ - command = "${lib.getExe cfg.format.package}", - }) - ) - ''; }; }; in { @@ -110,8 +103,13 @@ in { }) (mkIf cfg.format.enable { - vim.lsp.null-ls.enable = true; - vim.lsp.null-ls.sources.hcl-format = formats.${cfg.format.type}.nullConfig; + vim.formatter.conform-nvim = { + enable = true; + setupOpts.formatters_by_ft.hcl = [cfg.format.type]; + setupOpts.formatters.${cfg.format.type} = { + command = getExe cfg.format.package; + }; + }; }) ]); }