Omnisharp-vscode: Feature Request: EditorBrowsable.Advanced

Created on 20 Apr 2019  路  10Comments  路  Source: OmniSharp/omnisharp-vscode

Issue Description

UnityEngine has a deprecated public class iPhoneSettings, which always show before if for me. It lives under UnityEngine namespace so I can't avoid importing it.

Screen Shot 2019-04-20 at 16 49 18

Screen Shot 2019-04-20 at 17 04 37

Screen Shot 2019-04-20 at 17 07 45

Since very few class names start with lowercase letters, I wonder if I could control the order of this specific example. Or just exclude classes with lowercase letters from suggestions.

(Also I would like to confirm this behaviour is by-design: this plugin will always list iClass before if when typing on a newline?)

Steps to Reproduce

Open any Unity project repo, create a new script, import UnityEngine namespace, and type.

Expected Behavior

Prefer to list if over iPhoneSettings as it's more likely to be used (given context).

Actual Behavior

iPhoneSettings always listed before if.

Logs

N/A

OmniSharp log

N/A

C# log

N/A

Environment information

VSCode version: 1.33.1
C# Extension: 1.18.0

Mono Information
OmniSharp using global mono :5.18.1

Dotnet Information
.NET Core SDK (reflecting any global.json):
Version: 2.2.105
Commit: 7cecb35b92

Runtime Environment:
OS Name: Mac OS X
OS Version: 10.14
OS Platform: Darwin
RID: osx.10.14-x64
Base Path: /usr/local/share/dotnet/sdk/2.2.105/

Host (useful for support):
Version: 2.2.3
Commit: 6b8ad509b6

.NET Core SDKs installed:
2.1.4 [/usr/local/share/dotnet/sdk]
2.2.105 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download


Visual Studio Code Extensions

|Extension|Author|Version|
|---|---|---|
|applescript|idleberg|0.14.2|
|csharp|ms-vscode|1.18.0|
|mel|sator-imaging|0.1.2|
|python|ms-python|2019.3.6139|
|shader|slevesque|1.1.4|
|shaderlabvscodefree|amlovey|1.1.3|
|unity-debug|Unity|2.7.2|
|vscode-jade-snippets|mrmlnc|1.0.1|;

Feature Request

Most helpful comment

workaround: "editor.snippetSuggestions": "top"

All 10 comments

The best option is for Unity to decorate these APIs with the EditorBrowsable attribute.

I don't see the C# extension solving this problem.

@richlander I could request it, but there is a problem:

https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.editorbrowsablestate?view=netframework-4.8

Here is no Deprecated key for EditorBrowsableState, meaning there is no way to tell IntelliSense "we want to deprioritize this class in suggestion".

The Advanced key not well supported and doesn't change display order neither, I believe: https://github.com/dotnet/roslyn/issues/19940

@bitinn @richlander As always, the situation is nuanced:

  • Roslyn's completion list implementation would theoretically allow the OmniSharp to request/hide "Advanced" members
  • C# extension/OmniSharp don't currently expose a way for you to control what level you want
  • Unity doesn't decorate members

With regards to preferring if over iPhoneSettings: VS Code extensions don't have any control over how the list is filtered as you type. We provide the full list of items up front VS Code makes all decisions about what order to choose things.

The best we could do would be for all of the bullet points above to get implemented, in which case iPhoneSettings would always be hidden. However, there's no way for us to use EditorBrowsable data to drive how matches are selected as you type.

I'll keep this open in our backlog as a feature request.

@rchande Thx, I have opened a fix report to Unity, hopefully they will eventually add the EditorBrowsableState.Never to this class.

https://github.com/Unity-Technologies/UnityCsReference/blob/2018.3/Runtime/Export/iOS/iOS.deprecated.cs#L96

This is a very annoying issue I have to admit. Really hope something can be done.

I'd like to chime in to say this impacts me as well.

Much of the time if I quickly type "int" and spacebar it changes to "iPhoneSettings". Over a long period of time this had been a rather large drain on my productivity.

workaround: "editor.snippetSuggestions": "top"

workaround: "editor.snippetSuggestions": "top"

This works. However I'm also getting a full-blown foreach now instead of just the keyword :/
This issue is annoying as fruits :(

Would it be too inconvenient/hard/clumsy/expensive to keep a mini database of the amount of times each word was used and suggest first the most used one that matches what's being typed?

I am frustrated by this one as well. Especially IPhoneSettings often appearing when I want to type ifor int. Would it be possible to always prefer such basic language keywords over imported classes?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

mshinnie picture mshinnie  路  3Comments

slevengood picture slevengood  路  3Comments

visten picture visten  路  4Comments

jrmcdona picture jrmcdona  路  3Comments