Use :block rule as baseline indentation for :stair rule#98
Use :block rule as baseline indentation for :stair rule#98bullfest wants to merge 1 commit intogreglook:mainfrom
Conversation
| indent/reindent-lines {:indents indents} | ||
| ;; Note that this is parsed "wrong" as the expr-part is missing from the cond-> | ||
| "(cond-> a? (a 123)\n b?\n(b true))" | ||
| (str "(cond-> a? (a 123)\n" (space 13) "b?\n" (space 11) "(b true))"))) |
There was a problem hiding this comment.
This is some changed behaviour that I don't think would be possible to keep backwards compatibility with, afaik there's no way for the stair-indentation to tell if the form that's on the same line is the "leading form" (expr in cond->) or if it's a condition that's on the same line...
There was a problem hiding this comment.
On further consideration, it could be solved by only using block-indent as the base when the idx parameter is 0 which probably is reasonable.
Things like
(cond-> x a? (a 123)
b? (b true))is quite silly after all and probably not something that should be encouraged.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #98 +/- ##
==========================================
+ Coverage 89.82% 89.83% +0.01%
==========================================
Files 20 20
Lines 1907 1909 +2
Branches 60 60
==========================================
+ Hits 1713 1715 +2
Misses 134 134
Partials 60 60 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fix #97
Sorry about opening this before the underlying issue has been responded to, I had some extra time and thought I'd try my proposed fix.
A better solution might be to introduce a new rule instead, or add extra parameters to the rule as this would change some behaviour when leading forms are missing (see my comment in the tests).