scalameta / metals-feature-requests

Issue tracker for Metals feature requests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Highlight by-name arguments

odersky opened this issue · comments

Is your feature request related to a problem? Please describe.

My colleague Clement Pit Claudel had an interesting suggestion. It's often helpful to know whether a function argument is by-name or by-value. Can we have a way to highlight by-name arguments?

Describe the solution you'd like

He suggested to insert a grey arrow in front of a call-by-name argument.

I.e. if

f(x: => Int)

then f(1 + 2) would be highlighted as

f(=> 1 + 2)

Describe alternatives you've considered

Since by-name arguments often span multiple lines, a leading => is probably better than traditional syntax highlighting/

Additional context

No response

Search terms

by-name argument, syntax highlighting

Thanks for reporting! That should be be easy to do now since we use the compiler directly for showing synthetics etc.

@jkciesluk was looking into it, might be interesting to add it after finishing the work with inlay hints, which will replace the current custom protocol.

The biggest issue will be figuring out a way to convey to users all the possible options for decorations and what they will cause.