Bug: Generates broken code when combining respect-nl and ns-justify
Hi, thanks for a great formatter!
There seems to be a bug when combining the `:respect-nl` and `:ns-justify` styles.
I think I've reproduced an as minimal example that I can.
```edn
{:style [:respect-nl :ns-justify] :width 80}
```
```clojure
(ns test
(:require
[very.long.namespace.that-hits-the-limit-in-this-weird-way :as my-weird-way-ns]
[short-namespace-after :as foo]))
```
On the first pass of the formatter this results in
```clojure
(ns test
(:require
[very.long.namespace.that-hits-the-limit-in-this-weird-way
:as my-weird-way-ns]
[short-namespace-after :as foo]))
```
which I guess is somewhat fine.
However on running the formatter again it breaks the code, combining the `:as` keyword with the preceding symbol.
```clojure
(ns test
(:require
[very.long.namespace.that-hits-the-limit-in-this-weird-way:as
my-weird-way-ns]
[short-namespace-after :as foo]))
```
Noteably the fourth line here is exactly 80 characters, matching the width. If I add another character to the alias the problem doesn't occur.
关闭于 2025-05-20 2 条评论