0

I have posted on this before, but couldn't find a simple example. Here's one. I had some code commented out. Part if it was a comment. I used un-comment to turn the code back on for testing. And so this...

'check to see if this is a "simple" struct that has only basic types inside, not additional embedded type 5's

Turned into this...

check to see if this Is a "simple" struct that has only basic types inside, Not additional embedded type 5's

Look at the Is and Not. This isn't happening on all keywords, it appears that it's primarily Linq related terms get re-camel cased - Is, On, Where etc. And that's weird, because I don't have or use Linq in any of my projects.

This is annoying, but what is actually damaging is when this happens inside quotes. Let's say you had something like this...

'this is a "really long comment that I want to split into two lines"

Now I place my cursor in front of, say, "I" and hit return. This produces a second line with a trailing quote. Now every keyword in the entire file from that point on is re-cased, because there's an open quote confusing VS. Now my git diff is basically screwed.

Does anyone have any suggestions on what might be happening and how to turn it off?

Maury Markowitz
  • 9,082
  • 11
  • 46
  • 98
  • If you save your file, does it then re-case the `to` and `if`? – A Friend Jun 27 '17 at 15:32
  • Can you specify the exact version of visual studio you are using? I think I heard somewhere that it was fix in a patch. – the_lotus Jun 27 '17 at 15:40
  • That is a _feature_ of "Pretty listing (reformatting) of code". Tools Menu->Options->Text Editor->Basic-> Advanced-> Editor help in VS2015 and above. Turn it off to prevent stop the reformatting. – TnTinMn Jun 27 '17 at 17:43
  • @TnTinMn that was it. if you make that an answer I'll vote it. Any idea why the Linq keywords were triggering even though I don't use Linq? – Maury Markowitz Jun 27 '17 at 18:16
  • `"Any idea why the Linq keywords were triggering even though I don't use Linq?"` - I suspect that it just uses the language keywords list to identify text to reformat. It does not care whether the code uses LINQ or not. – TnTinMn Jun 27 '17 at 18:36
  • Yes, but its not doing this to most VB keywords. It doesn't do it to Loop for instance, or Next. But Where and In, it does. – Maury Markowitz Jun 27 '17 at 18:47

1 Answers1

3

The re-casing of keywords is a feature of "Pretty listing (reformatting) of code". This feature was less aggressive in VS versions earlier then VS2015 and did not run un-commenting a line.

To disable it go to:

Tools Menu->Options->Text Editor->Basic-> Advanced-> Editor help section

and uncheck "Pretty listing (reformatting) of code".

TnTinMn
  • 11,522
  • 3
  • 18
  • 39