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.
Brief Description
Fixes indentation issues for function parameters & pipes stacking indentation. Also provides an alternative indentation to pipes.
Fix Details
Indentation for function parameters.
There was no indentation provided for function parameters within the [] block. Examples
Pipe stacking indentation.
Sometimes pipes nodes can stack on each other on double (triple & so on) the indentation. This generally happens in this pattern:
This would probably occur most commonly in this scenario:
There isn't a straight forward fix to this, so it goes towards opinionated territory.
What I've done is remove pipeline indentation alltogether. This fixes the issue & I've seen only 1 place where the behaviour changes. Normally if you do a command at the start of a line, if you go to the next line you will automatically indent. This is because even a command at the start is consider a pipeline. I view this as a positive effect. However it would also remove indentation for the next line in cases you have a pipe at the end of the line.
That being said I think the indentation provided by (pipeline) nodes overall does more damage than provide convenience, so I think the best course of action is to simply remove its indentation effect & try and replicate it via other methods(the method I attempted is provided below).
Proposed change
Adding @indent.immediate to "|" for pipeline indentation. This creates python line indentation if you have an open pipe "|" at the end of the line. This approach works well with 2 caveats:
the above code is not valid syntax, as a naked pipe requires a command on the very next line (or a comment line). I view this as a minor issue, as even if the indent was not there if someone enters a couple of empty lines and then a command after a naken pipe it would still be invalid syntax. So it is an indent issue only when someone is writing invalid code in the first place.
In short, this approach gives you proper indent after naked pipes at the cost of breaking indentation within a pipeline if you use non-inline comments in the middle of a pipe.
Help required.
Someone should test the indentation file in helix. I personally wasn't able to get the indents.scm file to have any change in helix to properly test it.