Quantcast
Channel: Workarounds – no dogma blog
Viewing all articles
Browse latest Browse all 9

VS Code Bug – Interpolation and Commented Lines, Workaround

0
0

This is a quick post with a workaround to a bug in VS Code that occurs when you use string with @$ – the verbatim character and the interpolation characters.

If you have a piece of code that looks like this –

string text = @$"any text as long as there is a new line
/*";

Everything that comes after it will look commented out, like so –

This is a bit annoying because all coloring is lost below that /*.

You might not have hit this, but if start using Pulumi for IaC in AWS, you will because many permissions on resources often end with /*, or if you want to print some slashes and stars to the console.

Fortunately, there is a very easy workaround! Use $@ instead of @$.

string text = $@"any text as long as there is a new line
/*";

Much better!


Viewing all articles
Browse latest Browse all 9

Latest Images

Trending Articles





Latest Images