-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Find All References 'Kind' column values for Namespaces and Types. #31682
Conversation
What's the scenario where i care about this for namespaces? I totally get the value for Types. But i'm not really seeing the namespace case. |
@CyrusNajmabadi Primarily for completeness, especially given the implementation was pretty trivial to extend for namespaces. |
Ping for reviews... |
i would personally remove the namespace bit as i don't see an actual user scenario for it. Will review hte rest today/tonight though! (Note: you might want to just run the namespace part past @sharwell and @jasonmalinowski as well. if they think this is worthwhile, i'm ok with it). |
I have personally felt a weak preference for such a categorization at times. For example, when I wanted to audit all types declared under |
Btw, I understand that a simple textual search can address the above scenario - hence I don't have a strong push for namespace references categorization. |
Is this called 'Import' on the VB side? (note: i'm ok with it not being htat way. just curious). There's arguments for consistency (so you can filter down to all imports/usings with a single category), as well as them being different (to match the language). |
src/Features/Core/Portable/RemoveUnusedMembers/AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxFactsService.cs
Outdated
Show resolved
Hide resolved
/// Represents a reference to a namespace or type within a using or imports directive. | ||
/// For example, <code>using NS;</code> or <code>using static NS.Extensions</code> or <code>using Alias = MyType</code>. | ||
/// </summary> | ||
NamespaceOrTypeInUsing = 0x100, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDE style is to call this "Imports" when it refers to something across VB and C# and "import" is a more general term that fits equally well with both langauges, whereas 'using' is very c# specific.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can change the name here.
src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/AbstractSyntaxFactsService.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs
Show resolved
Hide resolved
src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs
Outdated
Show resolved
Hide resolved
I really like the NamespaceOrTypeUsage + ValueUsage change. Nearly all my points on it are simply nits about particular names/semantics. But the essence of the change is 💯 for me. |
Using this feature, will it be easy to find all derived classes of a class? |
Yes, in fact that was one of my primary use cases. You can filter references with “Base” as the only checked reference kind. |
Note: go-to-impl shoudl work for that case. That's one of the core use cases for it. |
@sharwell @jinujoseph can we bring this to design meeting next week? |
Update from the design meeting:
|
@dotnet/roslyn-ide @CyrusNajmabadi - Addressed feedback from the design meeting. Please review. |
Ping @dotnet/roslyn-ide for reviews. |
#30155 added a new 'Kind' column to FAR window to indicate if a reference to a method/field/property/event/parameter/local is a value read, write, reference or combination of these values.
This PR extends that column to now support rich reference kinds values for Namespaces and Types:
Using
), declaration (Declare
) or a name/member qualification, i.e. left side of dot (Qualify
).Using
), base type or interface in base list (Base
), object creation (new()
), a generic type argument (Type Argument
) or a name/member qualification, i.e. left side of dot (Qualify
).The terminology used here is a rough draft, that would go through a design review prior to merge - any suggestions are welcome!