Highlighting of arguments to by-name parameters

In Scala it's not always obvious when some expression is an argument to a by-name parameter.
New highlighting helps to easily spot such expression:
01.png

Scala plugin 0.4.670 or later is required (download)


Here's how it works:
02.png

You may also gray-out literals if you wish (disabled by default):
03.png

Block expressions are supposed to be called by-name, so, by default, there's no such highlighting for them:
04.png

However, you may turn it on:
05.png

The highlighting also works with implicit conversions that use by-name parameter:
09.png

Here's the definition of implicit conversion:
10.png

8 comments
Comment actions Permalink

This feature is very good.
The color chosen triggers a bit of a "dead code" feeling for me - IDEA uses such gray highlighting typically for unused/redundant things.

-tt

0
Comment actions Permalink

I too like the feature, but agree with Tara's comment on the choice of color. This is especially so in my specs, as large parts of the of the code is now greyed out. Because of this I find myself turning the feature off.

0
Comment actions Permalink

+0.85
let us configure the color.

0
Comment actions Permalink

We can add the color to the color scheme (but we need to choose some appropriate default one anyway).

0
Comment actions Permalink

what about very bright grey underscores/underwaves?

0
Comment actions Permalink

Has there been any decision on this? As far as we can see, the color is still not configurable (but maybe missed it?) and thus still triggers the "dead code/comment" feeling. I wouldn't mind gray being the default but it should really be configurable.

regards,

Bernhard

0
Comment actions Permalink

ideally, the highlighting should be a modifier to the existing highlight, not a unique setting. if i pass a larger block or expression, i still want to see it highlighted as usual scala code. if everything is greyed, blued or whatever, all highlighting information is lost just because the block is a call by name parameter. maybe an icon on the left side (like the recursion icon) should indicate the by name?

0
Comment actions Permalink

I created an issue for this thread, please watch/vote for it. http://youtrack.jetbrains.com/issue/SCL-5405
Not sure we will implement it before IDEA 12.1 release, but I'll definetely do this work in addition to implicit conversions highlighting, which is also have some usability problems for now.

Best regards,
Alexander Podkhalyuzin.

0

Please sign in to leave a comment.