dotnet / dotnet/roslyn

Add Intellisense suggestions support for static properties

Open
#79,321 0 comments 0 reactions 0 assignees View on GitHub
Area-IDE
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

## 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 :
```cs
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 `namespace`s 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
```cs
MyClass.StaticMethod()
```
or it could also add the `using static` directive at the beginning of file like this
```cs
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.