Starting from this article I'm developing a Visual Studio 2022 Extension that add next to standard CodeLens method reference count a custom method reference count invoking an API in our BPM software. In the context of a CodeLensDataPoint, what is the correct approach to thoroughly analyze the method and obtain information such as the reference class, any interfaces, method visibility indicators, essentially everything one would obtain using reflection.
[Export(typeof(IAsyncCodeLensDataPointProvider))]
[Name(Id)]
[ContentType("CSharp")]
[LocalizedName(typeof(Resources), Id)]
[Priority(210)]
public class CodeLensDataPointProvider : IAsyncCodeLensDataPointProvider
{
...
public Task<bool> CanCreateDataPointAsync(CodeLensDescriptor descriptor, CodeLensDescriptorContext descriptorContext,
CancellationToken token)
{
if(descriptor.Kind != CodeElementKinds.Method)
return Task.FromResult(false);
// here I would like to know method visibility indicator, class, interface implemented by class
return Task.FromResult(true);
}
public Task<IAsyncCodeLensDataPoint> CreateDataPointAsync(CodeLensDescriptor descriptor, CodeLensDescriptorContext descriptorContext,
CancellationToken token)
{
return Task.FromResult<IAsyncCodeLensDataPoint>(new CodeLensDataPoint(descriptor, claActionProvider));
}
}