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.91k stars 4.01k forks source link

Interceptor for Code Navigation for Source Generators #71805

Open vsfeedback opened 7 months ago

vsfeedback commented 7 months ago

This issue has been moved from a ticket on Developer Community.


Imagine the following scenario

[ObservableProperty] private string test;

where ObservableProperty is an attribute generating a INotifyPropertyChanged backed property 'Test' via source generators. (just like here https://learn.microsoft.com/en-us/dotnet/communitytoolkit/mvvm/observableobject)

When you perform a code navigation on 'Test' property (by clicking F12), VS will navigate to the generated source code, which has not much to do with the code that developers are working on. It's better to navigate to the private string test; line rather than the generated backed property code.

I could not find an option to switch this navigation behavior, but it'd be really cool if there is some sort of mechanism to switch this. The best solution to this problem right now is to do case sensitive search in the active file you work on, which is not very productive.


Original Comments

Feedback Bot on 1/9/2024, 07:31 PM:

(private comment, text removed)

RikkiGibson commented 7 months ago

Note that this doesn't appear to be related to the "interceptors" feature, it looks more like a pain point which will be addressed by implementation and adoption of the "partial properties" feature.