1

I'm doing some development in Visual Studio 2019.

If I edit a file and save it Visual Studio sometimes it renames it to PascalCase, sometimes to camelCase!

I've searched in options and can't find anything to turn this off. It's mildly infuriating. How do I stop this happening? It seems to be happening in both 16.4.0 and 16.4.2 versions.

zola25
  • 1,774
  • 6
  • 24
  • 44

1 Answers1

1

Are you sure this isn't a source control issue? Visual Studio doesn't, as far as I'm aware, change the case of filenames from what you've told it. If you rename a file it correctly renames it on disk.

However, Windows plus some source control tools treat PascalCase.jsx and pascalCase.jsx as the same file, so if you rename from one to the other your source control won't recognize a change. You'll have the renamed file locally, but even after a sync you'll still have the original filename in source control. Then if you do a clean checkout you'll discover the filename has reverted. Git does this. One workaround is to delete the file and recreate it

This may not be what's happening, it's a little unclear from your question!? Perhaps you can give more details on when the file gets renamed?

Rich N
  • 8,939
  • 3
  • 26
  • 33
  • You're right, silly me it must be git renaming it to what it was originally created as. – zola25 Jan 10 '20 at 17:32
  • It's a pain in fact: be aware that if you do delete and recreate it gets hard to look at file histories in git, so I wouldn't do it just because of inconsistent naming. – Rich N Jan 10 '20 at 17:36