Roslyn: Offer type names prefixed with '_', 'm_', and 's_' in editor completion list when declaring field

Created on 30 Aug 2017  路  5Comments  路  Source: dotnet/roslyn

Version Used: Microsoft Visual Studio 15.0.26730.10

Steps to Reproduce:

// Scenario 1:
private IFoo [|]

// Scenario 2:
private static IFoo [|]

Expected Behavior:

Scenario 1 _foo, m_foo, and m_Foo are offered in the completion list.
Scenario 2 s_foo and s_Foo are offered in the completion list.

Actual Behavior:

None of the suggestions above are offered in the completion list, although foo/Foo/GetFoo are.


Perhaps this isn't a bug and whoever implemented this feature just didn't think to add these suggestions, but prefixing fields with _ or m_ is common in a lot of projects so it would be quite valuable if this were fixed.

Area-IDE Feature Request

Most helpful comment

These completions should probably be tailored to the current code style, i.e. only one of the suggestions in each scenario should be included.

All 5 comments

These completions should probably be tailored to the current code style, i.e. only one of the suggestions in each scenario should be included.

@rawlinson If that is possible it would be great, when I wrote the post I assumed Roslyn didn't have any built-in mechanism for determining that.

It seems this is already implemented, at least in VS 15.4.0. Preview 1.0.
For the two scenarios above, I get _foo and s_foo respectively as the top suggestions, which match my code style.

Yep, this was already fixed by Ravi. @rchande - When did/does this ship?

@jamesqo We included support for using naming styles when we first shipped the declaration completion feature. Let me know if you're still seeing issues.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AdamSpeight2008 picture AdamSpeight2008  路  3Comments

JesperTreetop picture JesperTreetop  路  3Comments

marler8997 picture marler8997  路  3Comments

OndrejPetrzilka picture OndrejPetrzilka  路  3Comments

NikChao picture NikChao  路  3Comments