This project has moved and is read-only. For the latest updates, please go here.

Tagging Methods and Members

Sep 24, 2010 at 5:23 PM

I'm working on a Language Service, and I'd like to tag things are methods and members and their definitions so I can later in my resolver return them as such for intellisense. How would I go about that?




Sep 24, 2010 at 5:51 PM

Well, if you work with ParseTree/ParseTreeNode objects, then there's no extra "tag" field or dictionary there; maybe it's worth adding it, I'll think about it. For now you can use ParseTreeNode.AstNode field (it is object type) to store your tagging object.

Oct 8, 2010 at 10:01 PM

I've got the AST building now, but I was wondering if there was a way to get the grammar match and it's text, as well as it's row/col data. I can't figure out how to grab method names for doing intelisence goto.


Any help would be much appreciated.

Oct 13, 2010 at 6:50 AM

Are you producing AST or ParseTree only? if it is ParseTree, then there's Span property (which includes Location and length of the source fragment); you can then get the full source fragment from source text using these; 

Method names - my guess is you have to search parse/AST tree for specific "FunctionDef" nodes, then extract function name from it (it's one of its children I guess).

AST nodes also have references to source locations, but this depends on your AST model.