Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 VA 2476: interpolated verbatim strings
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Uniwares
Tomato Guru

Portugal
2322 Posts

Posted - Mar 09 2023 :  11:45:38 AM  Show Profile  Reply with Quote
When I have multiline interpolated verbatim string, syntax coloring for properties and methods is applied only in the first line.

Sample:
string test = @$"this line is correct {someClass.SomeMethod()}
     here VA syntax coloring ends: {someClass.SomeMethod()}
     dont even think {it.Works} here";


VS2022 17.5, C#

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Mar 09 2023 :  1:33:51 PM  Show Profile  Reply with Quote
Using C# 8 I have the following test code:

void stringHandling()
{
	int nLocalVar = 4;
	string filePath = @"C:\src\test\may_not_exist.txt"; // no need to escape anything in this string #CSharpVerbatimLiteralString
	// you can have #CSharpInterpolatedString #CSharpVerbatimLiteralString with start of @$ in C# 8, they need to start with $@ in C# 7
	string longerVerbatimString = @$"line one uses {nameof(nLocalVar)} which has the value {nLocalVar}
			while line two reports the file path is {filePath}
			and line three checks the length of the path {filePath.Length}";
}

I need to do this in C# 8 since in C# 7 you have to start the string with $@, not the @$ that you have in your example.

This is what I am seeing, using VS2022 and VA 2476.0. I am testing this correctly aren't I?



zen is the art of being at one with the two'ness
Go to Top of Page

Uniwares
Tomato Guru

Portugal
2322 Posts

Posted - Mar 09 2023 :  1:35:47 PM  Show Profile  Reply with Quote
One can use any combination @$ or $@ in newer C# versions, true. I guess you will see the difference only when you choose colors different from the default coloring in VS.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Mar 09 2023 :  1:44:22 PM  Show Profile  Reply with Quote
If I disable VA via:

VAssistX -> Enable/Disable Visual Assist X

then the bold disappears from the local variables, so VA is aware of these symbol names for me. If you try this with local variables, with local variables shown in bold turned On, is VA applying bold for you?

zen is the art of being at one with the two'ness
Go to Top of Page

Uniwares
Tomato Guru

Portugal
2322 Posts

Posted - Mar 10 2023 :  08:33:32 AM  Show Profile  Reply with Quote
Interesting, using your code in a simple file all is good. So there is some trigger in my other files. Need to check...
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000