helix icon indicating copy to clipboard operation
helix copied to clipboard

nix: fix indent and use alejandra

Open nrdxp opened this issue 2 years ago • 3 comments

Align indents to the way alejandra formats, and format automatically on save to keep the two in sync.

nrdxp avatar Sep 02 '22 23:09 nrdxp

I've tried it out a bit and it seems to work great. You still need to run cargo xtask docgen to fix the failing check. Also, in case you have a test file for Nix, you could add that: Just copy the file to helix-core/tests/data/indent, add a treesitter_indent_nix function to helix-core/tests/indent.rs and copy the Nix language definition to helix-core/tests/data/indent/languages.toml. It's not needed to get this PR merged but we currently only have 2 tests for rust so it'd be nice to expand that.

Triton171 avatar Sep 10 '22 10:09 Triton171

Thanks for testing, I've got it in draft now because there are still a few inconsistencies. I'm not sure there is an easy way to fix some of the current discrepencancies without extending the indent system a bit.

nrdxp avatar Sep 10 '22 17:09 nrdxp

If you have an example of inconsistencies that are difficult to fix using the current system, it'd be interesting to see it. The current indentation system is far from perfect so if some problem occurs often/in multiple languages, it would be nice to add indentation captures for it. If it's a rare case, regexes can sometimes be used as a workaround even though this isn't ideal (see for example the queries for rust).

Triton171 avatar Sep 14 '22 11:09 Triton171

clsoing this one as stale as its unfinished and has conflicts. Thank you for contributing!

pascalkuthe avatar Apr 13 '24 23:04 pascalkuthe