Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight by-name arguments #373

Open
odersky opened this issue Feb 10, 2024 · 1 comment
Open

Highlight by-name arguments #373

odersky opened this issue Feb 10, 2024 · 1 comment

Comments

@odersky
Copy link

odersky commented Feb 10, 2024

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

@tgodzik
Copy link
Contributor

tgodzik commented Feb 11, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants