-2

How do I get rid of the nameing violation warning in Visual Studio Code. The warning is as follows: Naming rule violation: These words must begin with upper case characters: enter image description here

I have looked in google but all the information I is about Visual Studio. Changing the casing is not realy an option since I would have to change the casing in more than 20 files.

  • 1
    have a look at: https://stackoverflow.com/questions/76828664/why-is-the-c-sharp-dev-kit-extension-giving-incorrect-redundant-warnings#comment135444371_76828664 – Rand Random Aug 07 '23 at 23:05

1 Answers1

0

First and foremost, generally speaking you should be following best practices for naming conventions (readability, clarity, appropriate and consistent camel & pascal case, etc).


This seemingly depends on whether you're using Micro$hit's LSP or Omnisharp.

Omnisharp

  1. Open settings
  2. search/go to: @ext:ms-dotnettools.csharp omnisharp.Enable Editor Config Support
  3. Disable this option.

LSP

I'm not entirely certain, since I reverted to Omnisharp the second it stopped being the default, however following other links has lead me to believe this is done by:

  1. In VSCode, go to the far left panel that is right below the File menu.

  2. Click on the Explorer tab.

  3. Right-click a blank area in the Explorer tab and click "New File" in the popup menu.

  4. Name the new file as .editorconfig (With the . at the beginning of the name)

  5. Open .editorconfig, and paste in the following code:

[*.{cs,vb}]

dotnet_analyzer_diagnostic.category-Style.severity = none

dotnet_analyzer_diagnostic.category-CodeQuality.severity = none
  1. Save the file, restart VSCode, and you are done!

To my understanding, the LSP method should work regardless of which language server is in use.

LCWilliams
  • 148
  • 3
  • 8