4

I have a problem with IntelliSense and it is driving me crazy, I kept calm for 1 month but I can't stand it anymore. IntelliSense keeps on suggesting things that are obviously incorrect suggestions.

Let's say I have a class called "PlayerModel" and a field/parameter of that type called "playerModel".

When I start typing "player" I somehow expect that the suggestions list will start with the field/parameter and not with the class, also given that the class obviously does not contain public constants or anything I might be using. But this is not the case, IntelliSense gives me this every time:

enter image description here

Obviously I want to refer to the parameter and not the class.

This doesn't work also if I need to assign a value to a field.

PlayerModel anotherPlayerModel = player...

will also suggest the class instead of that parameter. So every time I need to manually select the second (and proper) suggestion.

Please help, I think this should be common sense. Thank you!

These are my installation package details:

Microsoft Visual Studio Community 2017
Version 15.8.5
VisualStudio.15.Release/15.8.5+28010.2036
Microsoft .NET Framework
Version 4.7.02556

Installed Version: Community

C# Tools 2.9.0-beta8-63208-01
FormatDocumentOnSave 1.0
NuGet Package Manager 4.6.0
ProjectServicesPackage Extension 1.0
Visual Basic Tools 2.9.0-beta8-63208-01
Visual Studio Code Debug Adapter Host Package 1.0
Visual Studio Tools for Unity 3.8.0.7

And this is my PlayerModel class: (ignore the Unity related stuff it is not relevant to the structure of the class)

using UnityEngine;
using static Constants;

public class PlayerModel : ObjectModel {

    public int userId;

    public int activeItemIndex;

    public int kills;

    public PlayerModel(int id, Vector3 position, Quaternion rotation, float hitpoints, int userId, int activeItemIndex) : base(id, ObjectType.PLAYER, position, rotation, hitpoints) {
        this.userId = userId;
        this.activeItemIndex = activeItemIndex;
    }
}
Martin Asenov
  • 1,288
  • 2
  • 20
  • 38
  • Can you run the command "Get-WinSystemLocale" in PowerShell and report back the result? Also, you are incorrect that it's "incorrect" to give PlayerModel as a suggestion. There are many reasons why, in C#, you might want to use the class name, including static methods, casting, etc. Finally, are you typing "PlayerModel" with a capital "p" when you try to access the IntelliSense list? – Jazimov Jan 09 '19 at 17:59
  • hello, @Jazimov, no I am not typing it with a capital p, I start typing with small letter 'p' and the suggestion is always the class. You are right that I might want to use static methods and casting, etc. but this is not the case as I said, there are no static fields/methods. It just keeps on doing this every time the suggestion popup appears so it is not relevant to this case only. This is my locale info: "1026 bg-BG Bulgarian (Bulgaria)" – Martin Asenov Jan 09 '19 at 18:09
  • Did you meet this issue when you start use the VS community 2017? Could you please share the detail code of class PlayerModel and field/parameter playerModel, I will check it in my side with the same VS community 2017 version to see if this issue can reproduce or not. – Sara Liu - MSFT Jan 10 '19 at 09:34
  • hello, Sara, I updated the question with package info + the `PlayerModel` class definition – Martin Asenov Jan 10 '19 at 09:43
  • @SaraLiu-MSFT did you have success of reproducing it – Martin Asenov Jan 17 '19 at 21:05
  • Possible duplicate of [Autocomplete case issue](https://stackoverflow.com/questions/43922535/autocomplete-case-issue) – Hans Passant Jan 20 '19 at 14:23

1 Answers1

0

Please try switching your locale--as a test--from 1026 bg-BG to 1033 en-US. So, first close all instances of Visual Studio, apply the locale change, then restart Visual Studio. I suspect that this might fix the issue. If it does then you can decide which international setting you want to continue to use...

Jazimov
  • 12,626
  • 9
  • 52
  • 59
  • I changed it, let me play around a bit to see if it works. Out of curiosity why would such a change fix that problem – Martin Asenov Jan 09 '19 at 18:33
  • it didn't fix it, again I am getting class suggestion first even though there's a field/param called that (I updated the screenshot in the question) – Martin Asenov Jan 09 '19 at 18:39
  • Some sort functions key off of locale. I do not use Visual Studio Community edition and I see the lowercase items sorting ahead of uppercase items in IntelliSense in Visual Studio Enterprise. Do you have access to a non-community edition of VS on your workstation to see whether it might be a community IDE issue? – Jazimov Jan 09 '19 at 18:47
  • Unfortunately not, I am using it from home so it's not commercial project – Martin Asenov Jan 09 '19 at 18:49