roslyn icon indicating copy to clipboard operation
roslyn copied to clipboard

AutoCorrect wrong when using aliasses

Open vsfeedback opened this issue 4 years ago • 1 comments

This issue has been moved from a ticket on Developer Community.


[severity:It bothers me. A fix would be nice] Aliassing types will cause Intellisense to give wrong names for variables.

When aliassing for example two integers to make them human readable, as in my example code

using EntityId = System.Int32; using ComponentId = System.Int32;

And I have a function

_EntityId GetEntityIdByComponentId(ComponentId id) { ... } _

And I type it in another class, Intellisense gives the following definition in the intellisense popup

EntityId GetEntityIdByComponentId(EntityId id)

As you can see IntelliSense cannot differentiate between the different aliasses. Probably because they are of the same type System.Int32.

This is cosmetic but it can throw you off of the true meaning of your code and make you think you made a mistake, so it bothers me.

Either IntelliSense should show it as an Int32 or give back the alias that you used in the function definition.

That said I sill love Visual Studio and C# :-)


Original Comments

Feedback Bot on 11/1/2021, 00:56 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.


Original Solutions

(no solutions)

vsfeedback avatar Nov 03 '21 17:11 vsfeedback

It's definitely an interesting suggestion. It seems reasonable to try to track this info an attempt to match to another equivalent alias if possible if the original alias names matched. It might turn out to be very complex to do though depending on how much information is erased.

CyrusNajmabadi avatar Nov 04 '21 19:11 CyrusNajmabadi