Dynamic Intelliprompt

SyntaxEditor for Windows Forms Forum

Posted 20 years ago by Jan van de Pol
Avatar
Hi All,

Currently I'm implementing a custom expression language into my application. This expression syntax consist of static keyword and operators and dynamically created datasource references. A datasourcereference will always be preceeded by the '@' symbol. The following would be a valid syntax:

IIF( @MyTable.MyField = "MyValue", "OK", "Not the expected value" )

Where
IIF is a function
@MyTable.MyField is a dynamically datasource reference

Now I want to use intelliprompt functionality for 2 goals:
1) Code completion: When I type the "I" and press CTRL-SHIFT-SPACEBAR it should look for all keywords starting with I and present them in dropdown list or if only one it should be inserted immediatly. Very much similar to VS.NET 2003.

2) Dynamic Intelliprompt. At entering the '@' sign a dropdown list must appear with all (previously at runtime configured) datasources. Pressing the "." symbol after a valid datasource must show a dropdown list with all fieldnames.

Has anyone an idea on how to implement those two goals into one editor? I managed to achieve (a part of) goal 2 by clearing the memberlist of the intelliprompt object and fill it again within the trigger event. But I'm not quite sure if this is the right way to go...

Thanks in advance for any comments,

Jan van de Pol

Comments (1)

Posted 20 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Jan,

The latest build has a new TokenStream which is ideal for doing semantic parsing. With that you can iterate over the Token objects in the Document. When you're scanning through Tokens to figure out what member list items to display, I highly recommend scanning using the TokenStream. The "editor_Trigger" event handler in MainForm.cs in the sample project shows how to do this.

For your second item, you definitely want to set up keypress triggers in your langauge def. Our C# sample shows how to set up a "." to display a member list. This is the same thing as what you're attempting to do but you want to do it for a "@" as well. The "editor_Trigger" (same as above) shows a sample of how to handle the trigger and display a list.


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.