vscode-csharp icon indicating copy to clipboard operation
vscode-csharp copied to clipboard

Add Intellisense suggestions support for static properties

Open AtlasRW opened this issue 4 months ago • 0 comments

Introduction

Any type of static properties, methods, fields, or const can be assigned to either classes or structs, so to avoid repetitive descriptions I'll only use static methods on classes for this example, but my issue stays the same in other combinations.

Description of my problem

I'm always frustrated when the suggestions from Intellisense are not including (accessible) static methods from other classes, the only way is to type the name of the class first, but Intellisense suggestions are really helpful to me especially when I can't remember the correct namespace for the class containing the method I'm looking for, and it also helps me by autofilling the using Namespace needed, but it is far less helpful when looking for static methods. For example, let's use this basic setup :

public static class StaticClass
{
    public static void StaticMethod() { }
}

From other classes, Instellisense suggestions only work if I'm typing the name of the class containing the method, but it simply doesn't find the method directly :

Image Image

The solution I would like

While typing the name of an (accessible) static method, Intellisense would find it like it finds classes into different namespaces and propose it to me, with the correct namespace on the side like it does usually but with the name of the class containing the method, like this :

Image

and if I select this option it either fills the complete path with the required namespace to the method/property like this

MyClass.StaticMethod()

or it could also add the using static directive at the beginning of file like this

using static MyClass;

StaticMethod()

Conclusion

Truly hope to see this feature one day as it would really me in my work everyday, and thank you very much to all contributors and team for all your time and effort

AtlasRW avatar Jun 25 '25 19:06 AtlasRW