Posted 14 years ago by GeorgeNY - CTO, RatchetSoft, LLC
Avatar
I'm using the Syntax Editor for WinForms (current version) and the .NET Addon. I'd like to implement a "Go To Declaration feature which would allow the user to position the caret at a certain location... for example (^ is caret location):

string s = var^1 + var2 + var3


If the caret is in var1, i would like to have a hotkey bring me to the location of var1's declaration. It might be a local variable or it might be a member of this class or another class within this instance of the syntax editor. A cursory investigation leads to me compilation units and such.

My questions are:

1) is this possible? if so, how?
2) is this very complex?

George P Weihs

Comments (1)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi George,

Yes you are correct, you'd want to look at the AST in the document's SemanticParseData property. You'd have to locate the AST node that contains the caret. Then you'd have to iterate up the tree and backwards to look for AST nodes that could declare the variable such as a statement that does it or possibly a parameter to a containing method. Each AST node has a navigation offset you can then move the caret to, so you can go to the appropriate declaration node if one is found.


Actipro Software Support

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.