Resolve System.Reflection.MemberInfo from caret position

SyntaxEditor .NET Languages Add-on for Windows Forms Forum

Posted 11 years ago by Nicklas Chapman
Avatar
Hi,

I am using SyntaxEditor with the .NET add-on to edit C# code.

I would like to use Actipro's parsing capabilities to resolve a System.Reflection.MemberInfo from the current caret position in the editor. I have managed to resolve a MemberAccess expression easily enough, but to make the last step to an actual MemberInfo I have had to write a whole lot of code covering cases such as static members on other classes, members inherited from a base class or members referenced on an object returned by native properties.

I have the feeling that I am missing something and that I should be able to make a better job of using the parsing engine included.

What is the best way to resolve a MemberInfo object from the current caret position?

Thanks and best regards.

Comments (1)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Niklas,

You can get context information by calling a static method like GetContextBeforeOffset on the CSharpContext class. There you pass it a document and an offset and it determines what it is for you if it can. Hope that helps!


Actipro Software Support

The latest build of this product (v2020.1 build 0400) was released 24 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.