Version Used: C# 7 new feature request
Steps to Reproduce:
If I type the following code in the editor the IDE will be smart enough to translate or resolve the interpolated string and show me the result in a tooltip when I hold my mouse pointer for a second or two.
var price = 500
var message = "The price is @price" // The tooltip will show: The price is 500
Expected Behavior:
Actual Behavior:
Syntax aside (which, if you follow your own thread at #9772, especially @mgravel's comment should make it clear why it won't happen), it is more or less not possible to evaluate variables like that, to produce meaningful data without incurring side effects (aka evaluation).
You should look at Alive (also built on top of Roslyn). It takes a nontrivial amount of work to support this, and not just for interpolated strings.
$"The price is {price}" is.@HaloFour I believe you might be wrong on 3., with Roslyn IDE now shows constant and enum values in tooltips. It does not evaluate the constant expressions but it seems to infer the enum values.
@miloush Yes, it does for simple constants, but not for constants that are the result of constant expressions, e.g. const string BAR = "FOO" + BAZ;. I should have been more clear about that.
String.Format Diagnostics had the capability of display the potential output as a Info diagnostic.
Looks to be a troll having some fun; see all suggested issues: https://github.com/josejmoran
Thanks for the suggestion. We're not planning to build this into Visual Studio, but you should take a look at http://comealive.io.
Thanks Dustin, I like comealive.io it is great!! awesome!!
Most helpful comment
$"The price is {price}"is.