I'm building a programmable piece of software. Idea was to let the end users controll the host system through some scripting. Hence the software comes with a script editor for which I'm using RSyntaxTextArea. All is well till here.
As a final touch, I thought of adding some sort of IntelliSense to the script(The script language is Rhino) editor and I'm not sure how exactly to best implement this(at least to some extent).
To get started, I have started with this amateur approach :
- .(dot) character invokes the whole suggestion process.
- The script content (excluding the current statement) is *eval*uated and from which I identify variables/functions defined so far and their type. The suggestions are computed based on this.
Alternatively instead of evaluating the script(which is premature), I'm thinking about building AST. Is this a right way to approach this? Do you have any suggestions/links/algorithms etc.. ? How to handle the case when the current state of the script is not compilable? Please advice.