Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to disable raw string conversion suggestions from IntelliCode in Visual Studio?

I write C# files in VS2022.

Oftentimes I will write multi-line strings like so, and Intellisense will repeatedly (it takes < 40 characters) suggest to put it all on the same line, like so:

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

This is obviously awful, I don’t want that, and I’m certainly not in the habit of writing multi-paragraph strings in one line, but it just keeps suggesting it. This would be fine… if a space didn’t accept its suggestion, making it virtually impossible to write multi-line strings without turning C# suggestions off entirely.

Is there a way to turn off specifically IntelliCode suggestions to put multi-line strings on the same line? I see no such thing in the place I’d expect to find such an option should it exist:

enter image description here

>Solution :

As you can see, the "[i]ntellicode suggestion is based on recent edits". This means, that it is based on edits you have made, and therefore does not map to any style rule. It proposes this, because you appear to have made similiar edits in the past. However there should be a light bulb, when hovering over this section, on which you can select ignore with a right click.
See https://devblogs.microsoft.com/visualstudio/making-repeated-edits-easier-with-intellicode-suggestions/.

However I would recommend to use "raw string literals" either way. This is of course up to you though..

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading