Highlighting of arguments to by-name parameters Follow
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:
Scala plugin 0.4.670 or later is required (download)
Here's how it works:
You may also gray-out literals if you wish (disabled by default):
Block expressions are supposed to be called by-name, so, by default, there's no such highlighting for them:
However, you may turn it on:
The highlighting also works with implicit conversions that use by-name parameter:
Here's the definition of implicit conversion:
Please sign in to leave a comment.
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.
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.
let us configure the color.
We can add the color to the color scheme (but we need to choose some appropriate default one anyway).
what about very bright grey underscores/underwaves?
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.
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?
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.