tomasr / viasfora

A Visual Studio Extension containing miscellaneous improvements to the editor.
Other
557 stars 91 forks source link

String interpolation bug #259

Closed theplasmastorm closed 5 years ago

theplasmastorm commented 6 years ago

Viasfora doesn't like to color the curly braces inside nested string interpolation. Convoluted example:

string a = "a";
string b = "b";
string c = "c";
string s = $"{(string.IsNullOrWhiteSpace(a) ? $"{b}" : $"{c}")}";

image

Viasfora also doesn't like string literals inside string interpolation. A broken example:

string a = "a";
string b = "b";
string s = $"{(string.IsNullOrWhiteSpace(a) ? @"\" : $"{b}")}";

image

Using Dev15.8.5 Viasfora 4.1.182

tomasr commented 5 years ago

Yes, this is never going to work properly. My current implementation is a bit of a hack. The problem is that it's impossible to handle all cases using just lexical analysis, and handling nested strings requires way too much state to track what's going on....