I'd like to add Kotlin range inlay hints please v...
# intellij
v
I'd like to add Kotlin range inlay hints please vote for the default one (number
:4
is in 🧵 )
4️⃣ 10
1️⃣ 3
4
2️⃣ 7
3️⃣ 2
j
can you add 4, which would be 1 at the end like 3?
like you have shared on twitter
1
v
that's 4️⃣ :
e
1️⃣ doesn't show empty ranges well (e.g.
0..-1
is different from
0 downTo -1
), 2️⃣ has confusing precedence, and 3️⃣/4️⃣ are too long (e.g.
complex expression .. complex expression
). IntProgression (e.g.
0..10 step 2
) would be hard to fit in. I'm not sure how to resolve any of this.
w
What if there are two ranges at the same line in 4️⃣?
c
it looks nice but it does not really add any relevant information (like for example type inlay hints)
1
m
1️⃣ doesn’t add much value unless you’re familiar with
[ ] ( )
range notation. It’s most likely not useful to the average developer. So it’s just adding another potentially unclear notation to the existing potentially unclear notation. It’s also very difficult to distinguish between the different bracket types unless you look really closely. 3️⃣ and 4️⃣ are quite verbose and disruptive. They work badly if there are multiple ranges. Even worse if range start and/or end are anything but a simple expression. Repeating the expression in the hint will blow up line length very quickly. 4️⃣ has the same issue as 1️⃣ regarding bad readability of the bracket types and that the average dev doesn’t know that notation. 2️⃣ works in terms of length. It’s way more subtle than the other ones. It also more clear to the average developer as it uses familiar comparison operators. I would however use
<=
instead of
. Developers are familiar with that operator in Kotlin. And
<
and
are very difficult to distinguish unless you look very closely or have amazing eye sight and display contrast. Overall I’d say either 2️⃣ (with Kotlin operators) or none at all.
e
I disagree in general about ≤≥, but in an inlay hint they have lower contrast which is something to consider
after some time to reflect, I think I would prefer a totally different option: replace `..`/`rangeTo`/`until` with
, replace
downTo
with
, and modify the symbols to have solid/hollow ends as appropriate