clj-refactor.nvim
clj-refactor.nvim copied to clipboard
`cril` (introduce let) does not properly indent the body of the new `let` form
For example, I have this top-level form:
(defrpc campaigns
[& [opts]]
{:rpc/pre (and (have-api-key) (have-network))}
(->> (view/campaigns (network) opts)
(map #(safe-parse-json % :customfields))))
When I put my cursor on the ( before ->> and enter cril and enter cs for the binding name, the result is:
(defrpc campaigns
[& [opts]]
{:rpc/pre (and (have-api-key) (have-network))}
(let [cs (->> (view/campaigns (network) opts))]
(map #(safe-parse-json % :customfields))))
cs
I use parinfer, so it re-balanced my parens because cs was all the way to the left, so it was judged to be another top-level form. The bindings part of the let also got closed prematurely because the line after it wasn't indented far enough to the right.
If I disable parinfer and do the same thing, I get this, which is still not indented properly:
(defrpc campaigns
[& [opts]]
{:rpc/pre (and (have-api-key) (have-network))}
(let [cs (->> (view/campaigns (network) opts)
(map #(safe-parse-json % :customfields)))]
cs))
Note that not only is cs not indented at all, the previous line also has incorrect indentation now because it didn't move from where it was before.