I am writing an Eclipse plugin for a 2D game engine (<http://www.ksatechnologyhq.com:1357/>) that has its own scripting language. I want to index all scripts in AIGE projects, so I can fill content assist lists with functions from other files (like Eclipse does with Java). How is this done?
(By the way, here is the only documentation on the syntax on said language and the extensions I want to use are AHLSL and H开发者_运维百科LSL.)
If you have a DSL (Domain Specific Language) that has no tooling and that you would like to provide an editor for, consider using Xtext. You need to provide a grammar file for your DSL, and XText generates an eclipse editor with hooks for providing Syntax Highlighting, Code Completion, Validation, quick fixes, etc.
See Getting Started for a mini-tutorial on turning a DSL to a grammar.
UA (like Help) uses Apache Lucene to index all of its content to allow for searches. Aside from looking at the org.eclipse.help code, see also http://en.wikipedia.org/wiki/Lucene and http://darksleep.com/lucene/. Eclipse SDK ships with 3 org.apache.lucene bundles.
AFAIK JDT maintains an AST (Abstract Syntax Tree) model. The editor keeps its model up to date, and so at any given point has access to, say, all the methods that can be called for that object. If I find out more I'll add an edit.
PW
精彩评论