Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 VA 2476: interpolated verbatim strings

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
Uniwares Posted - Mar 09 2023 : 11:45:38 AM
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#
4   L A T E S T    R E P L I E S    (Newest First)
Uniwares Posted - Mar 10 2023 : 08:33:32 AM
Interesting, using your code in a simple file all is good. So there is some trigger in my other files. Need to check...
feline Posted - Mar 09 2023 : 1:44:22 PM
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?
Uniwares Posted - Mar 09 2023 : 1:35:47 PM
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.
feline Posted - Mar 09 2023 : 1:33:51 PM
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?



© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000