Roslyn: Naming of naming styles should reflect their casing

Created on 24 Apr 2019  Â·  9Comments  Â·  Source: dotnet/roslyn

Version Used:

Microsoft Visual Studio Enterprise 2019 Int Preview
Version 16.1.0 Preview 3.0 [28823.117.d16.1]
VisualStudio.16.IntPreview/16.1.0-pre.3.0+28823.117.d16.1
Microsoft .NET Framework
Version 4.8.03752

Steps to Reproduce:

  1. Ctrl Q
  2. Type 'C# naming'
  3. Enter
  4. Open the drop down "Required Style" for any entry

Expected Behavior:

Finding the following entries:

  • PascalCase
  • camelCase

Actual Behavior:

These entries:

  • Pascal Case
  • Camel Case

Was raised here.

Area-IDE Feature Request Need Design Review

Most helpful comment

Alas kebab-case isn't valid C#

All 9 comments

Will there be support for snake_case ?

Will there be support for snake_case ?

I think this might violate good taste :-)

Alas kebab-case isn't valid C#

Will there be support for snake_case ?

I think this might violate good taste :-)

To be honest lot of public APIs are using snake_case in their JSON objects and it's much easier to maintain C# POCO in snake_case for those APIs.

That's fair, although I'd rather configure a JSON.NET casing strategy than making my C# POCOs look weird.

Hypothetically, if you had that casing option, how would you configure the system thought? There are no namespace / attribute filters. Presumably, you don't want to apply this convention everywhere.

I was thinking that naming can be tied to particular project. Not sure though if it's possible at the moment.
Anyway I was able to create custom snake_case :)

image

Alternative to the original suggestion, I think adding an example after the name would also work very well:

  • “Pascal case (HttpClient)”
  • “Camel case (httpClient)”

This would probably be a bit more in line with the other option there.

The main dropdown called Capitalization already has correct styling of its values. The issue is with the titles of default naming styles which come with Visual Studio installation.

image

Mentioning that drop down, it does appear a bit inconsistent that the first two options refer to the general style names (pascal case and camel case), while the lower three options are descriptions of what they do.

We could have the first two be “All words capitalized” and “All words except first capitalized” respectively to match with the others; although I do think that it is useful to keep the pascal/camel case in there somewhere (maybe in parentheses). Or we come up with names for the other three (the name for the third is actually “Title case”).

That being said, the third option should actually be ”First word capitalized” instead of “First word upper”, otherwise it should probably be HTTPclient or SERVICEprovider.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Pilchie picture Pilchie  Â·  113Comments

MadsTorgersen picture MadsTorgersen  Â·  249Comments

MadsTorgersen picture MadsTorgersen  Â·  120Comments

MadsTorgersen picture MadsTorgersen  Â·  542Comments

ilexp picture ilexp  Â·  167Comments