dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.99k stars 4.03k forks source link

Emphasize members declared in current type above members declared in base types #42676

Open jnm2 opened 4 years ago

jnm2 commented 4 years ago

ReSharper shows immediate members in bold. I'm not sure that's my favorite way to style it, but it is an effective way to know what's important beyond the top 5 members starred by IntelliCode. A great example of this is to dot off a bunch of Roslyn syntax classes and see how easy it is to scroll through and identify every new member that is available versus the glut of members and extension methods inherited from SyntaxNode.

Maybe "immediate" (non-base) members could be normal and base members could be a light font weight or very slightly faded?

A filter toggle could be an alternative, though I'm not sure I'd prefer that.

ReSharper: I know exactly what this type has to offer

image

Visual Studio: I'm going to have to peer at the whole list while scrolling through and comparing against my memory of the base type

image

jnm2 commented 4 years ago

Similar to https://github.com/dotnet/roslyn/issues/16685, but that one is about sorting and I'm much more interested in the differing style than in the sort order.

CyrusNajmabadi commented 4 years ago

talked to @AmadeusW . Currently no way to do this without completely reimplementing the presenter ourselves. @AmadeusW is there a hacky way to potentially do this in the short term? So we could at least try this out?

AmadeusW commented 4 years ago

@CyrusNajmabadi you can access properties of individual completion items and, for example, make the text bold. ou're welcome to make a PR to the VS-Platform repo. Open Editor.sln, make changes in DefaultCompletionControl.xaml.cs and F5-deploy to verify. I can help you get unblocked.

CyrusNajmabadi commented 4 years ago

that would be awesome!

      -- Cyrus
sharwell commented 3 years ago

Also related to #19256

genlu commented 2 years ago

I might need to make some change in editor, so this would be a good opportunity for me to hack something around the bold text. And thanks for linking #16685 and #19256. I didn't know monodevelop had the grouping feature before and lost it after moving to Roslyn. Now I really want it :)

A filter toggle could be an alternative

Just to make sure I understand this correctly, you mean a filter that shows only immediate members when toggled, right? I agree this would not be a preferred way for showing this information, but it might be a feasible idea to address the grouping/sorting issue: we can add a filter toggle to sort by member definition's distance on hierarchy chain, we can even change the inline-description to show the type it's declared in when toggled to make it clear (@AmadeusW proposed something that actually shows grouping in the list in #19256, but it requires bigger change in editor). The problem here is the way filter being used in this scenario is semantically different from existing ones, maybe I can hack around this issue with Expander instead.