Indexer EP

The Indexer EP allows developers to override how current program elements are indexed. Developers can add new fields to indexed methods, such as adding a "surrounding text" field, or even replace all fields in a given program element.

Usage

  1. Extend either the SrcMLCSharpParser or SrcMLCppParser
  2. Extend just MethodElement or CppUnresolvedMethodElement and MethodElement
  3. Add new fields to be parsed to MethodElement or CppUnresolvedMethodElement and MethodElement
  4. Override ParseMethod or ParseCppFunction, populating only added fields and using base class to populate normal fields
  5. Add this new parser to Sando's configuration file (link to come)

API

Class Sando.Parser.SrcMLCSharpParser
Method MethodElement ParseMethod() - Parse and populate additional fields in CSharp
Class Sando.ParserSrcMLCppParser
Method MethodElement ParseCppFunction() - Parse and populate additional fields in C++

See Sando.Parser.UnitTests.MyCSharpParserTest for an example of adding a field to a CSharp method element.
See Sando.Parser.UnitTests.MySrcMlCppParser for an example of adding a field to a C++ method element.

Default implementation

  • Populates all fields in MethodDocument, ClassElement, CommentDocument, FieldDocument, EnumDocument, DocCommentDocument, MethodPrototypeDocument, and StructDocument
  • Note that not all fields are searched by Sando

For details see: MethodDocument.cs

Example Scenario

An extension could use text summarization to create a summary of the documentation of each class that is used in a method, and add this new text to a field called "related text". This field would also be searched during the search process.

References

  • N/A

Last edited Jun 19, 2012 at 8:48 PM by davidcshepherd, version 8

Comments

No comments yet.