Use nix-indent-line
as the default indentation function
#198
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Somewhat closes #57
Basically, this change unifies
nix-indent-line
with SMIE, in that it uses the latter most of the time, only falling back to hand-baked indentation functions when SMIE would return something surprising. I've been using this for a few months, and haven't noticed any problems so far.The changes so far are somewhat backwards incompatible, and should be seen as an extreme version of what they could be. I'm happy to e.g. completely revert 0f480d2 in case people think keeping these functions around is worthwhile.
Commit summary
nix-smie-rules: Fix indentation of ","
This seems deceptively simple, but there are actually quite a few situations that can occur; e.g.,
Thankfully, smie already sanely handles all of these for us, so rely on that instead.
nix-indent-line: Use smie-indent-line in most cases
SMIE does not know how to handle multiline strings, but other than that it's quite a solid foundation—use it.
Make old indentation functions obsolete
SMIE is necessary now, and nix-indent-line is the one and only indent function to use.
[EXPERIMENTAL] Remove old nix-indent-line code