Open ppenguin opened 2 months ago
Looks reasonable. Though, I will need you to format via alejandra
and not nixfmt
. The formatting check is failing.
Other than that, if there is a known formatter for HCL I can work on getting it added tomorrow. We will need null-ls (or none-ls) to support HCL for proper formatting.
Looks reasonable.
Thanks for looking into it so quickly...
Though, I will need you to format via
alejandra
and notnixfmt
. The formatting check is failing.
Ah yes, different than nixpkgs
:sweat_smile:
While we're at it, is there a trick that I can (e.g. via direnv
) use the active HM config for nvf
but override certain attributes (like the formatter) in a devshell (when I'm in the nvf
repo)? Or would I need to outsource my "standard" nvf
config to a separate flake for that?
Looking at none-ls builtins, I see an formatter source for Terraform. This could be used to add formatter support via terraform fmt
. Refer to other language modules on how formatter submodules are added - the process is extremely straightforward but I'll be around if you have questions.
While we're at it, is there a trick that I can (e.g. via direnv) use the active HM config for nvf but override certain attributes (like the formatter) in a devshell (when I'm in the nvf repo)? Or would I need to outsource my "standard" nvf config to a separate flake for that?
Afraid there isn't a way to impurely override configuration per-project, but we do provide a formatter that will format the code for you with nix fmt
. I will consider making this a pre-commit hook, or at least have pre-commit warn you before you commit the changes.
Looking at none-ls builtins, I see an formatter source for Terraform. This could be used to add formatter support via
terraform fmt
. Refer to other language modules on how formatter submodules are added - the process is extremely straightforward but I'll be around if you have questions.
I finally got around to finish this one. In hindsight I might have gone a bit overboard with (unnecessary?) extensibility (inspired by the bash
setup), but given the fact that terraform-ls
is a bit too generic for nomad
, there may be more specific solutions in the future that we might then easily integrate.
EDIT: spelling (noticed spelling "funture", I might be on to something :rofl )
Terraform doesn't register hcl and doesn't offer good DX if manually set for editing e.g. nomad HCL files.
My first nvf contribution. Maybe somebody could show how to integrate a formatter as well. Other than that it's already an improvement for editing non-Terraform files (e.g.
nomad
), but it could be probably better. (I vaguely remember the vscode plugin offered some more features).