max-line-length not respected when sorting large refer forms
lassemaatta opened this issue · comments
Describe the bug
I can specify the maximum line length for sorting :refer [...]
forms in the config (:max-line-length
). However, if there are a lot of referred symbols, it seems like this limit only applies to the first few lines of code.
To Reproduce
Sample file:
(ns mock
(:require [clojure.core :refer [abs accessor aclone add-classpath add-tap add-watch agent agent-error aget alength alias all-ns alter alter-meta! alter-var-root amap ancestors and any? apply areduce array-map as-> aset aset-boolean aset-byte aset-long aset-short assert assoc assoc! assoc-in associative? atom await await-for await1 bases bean bigdec bigint biginteger]]))
(def my-functions
"refer to vars so that cleanup won't remove them"
[abs accessor aclone add-classpath add-tap
add-watch agent agent-error aget alength alias
all-ns alter alter-meta! alter-var-root amap ancestors and any? apply areduce
array-map as-> aset aset-boolean aset-byte aset-long aset-short assert assoc
assoc! assoc-in associative? atom await await-for await1 bases bean bigdec bigint biginteger])
With :max-line-length 50
I get the following (|
represents the limit), where the first two lines respect the line limit.
(ns mock
(:require [clojure.core :refer [abs accessor |
aclone |
add-classpath add-tap add-watch agent agent-error aget
alength alias all-ns alter alter-meta! alter-var-root
amap ancestors and any? apply areduce array-map
as-> aset aset-boolean aset-byte aset-long
aset-short assert assoc assoc! assoc-in associative? atom
await await-for await1 bases bean bigdec bigint
biginteger]])) |
With :max-line-length 80
we get similar results, only the first two rows respect the limit:
(ns mock
(:require [clojure.core :refer [abs accessor aclone add-classpath add-tap |
add-watch agent agent-error aget alength alias|
all-ns alter alter-meta! alter-var-root amap ancestors and any? apply areduce
array-map as-> aset aset-boolean aset-byte aset-long aset-short assert assoc
assoc! assoc-in associative? atom await await-for await1 bases bean bigdec bigint
biginteger]])) |
And finally with 120 limit:
(ns mock
(:require [clojure.core :refer [abs accessor aclone add-classpath add-tap add-watch agent agent-error aget alength |
alias all-ns alter alter-meta! alter-var-root amap ancestors and any? apply areduce |
array-map as-> aset aset-boolean aset-byte aset-long aset-short assert assoc assoc! assoc-in associative? atom await
await-for await1 bases bean bigdec bigint biginteger]])) |
Expected behavior
The :max-line-length
limit should be applied to all lines.
User details (please complete the following information):
- OS: MacOs
- Editor: Emacs
- Version:
clojure-lsp 2023.10.30-21.15.51-nightly clj-kondo 2023.10.21-SNAPSHOT