Intellisense and Method Tips for lisp?

SyntaxEditor for Windows Forms Forum

Posted 19 years ago by Chris Sells
Avatar
I'd like to use SyntaxEditor to build intellisense and method tips for a lisp dialect, e.g. pop up possible method names when an open paren is typed and then show the needed parameters when a space is typed after a method name. I'm completely new to SyntaxEditor; how do I get started? Thanks!

Chris Sells
http://sellsbrothers.com

Comments (8)

Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Chris,

That's easy to do. You want to set up KeyPressTriggers for the "(" and " " characters.

Take a look at our C# language sample. It makes triggers for "." and "<". You want to do the same thing except for your characters and you have to determine what lexical state they are valid in.

After you do that, the SyntaxEditor.Trigger event will fire whenever those keys are pressed while within that lexical state and you can display your member lists. Our sample project shows this in the "editor_Trigger" event.


Actipro Software Support

Posted 19 years ago by Chris Sells
Avatar
the single sample is enormous! I can't tell how much of it I need to do. is there something simpler? a "hello, syntaxeditor" sample?
Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
For making a simple member list with items you just want to populate yourself, go to the "editor_Trigger" event handler and search for the "XMLCommentTagListTrigger" case statement. Within the case statement code is the barebones sample of populating and showing a member list.

It's more or less just this...
1) Set an imagelist
2) Clear the list of items
3) Add your items
4) Show the list


Actipro Software Support

Posted 19 years ago by Chris Sells
Avatar
I'm trying to set up a language file, but when I feed it the following file, it gives me a NullReferenceException (below):
<!-- lisp.xml -->
<SyntaxLanguage Key="lisp" LanguageDefinitionVersion="3.0" Secure="False" xmlns="http://ActiproSoftware/SyntaxEditor/3.0/LanguageDefinition">
    <!-- Triggers -->
    <Triggers>
        <KeyPressTrigger Key="LamdbaListTrigger" Character="(">
            <KeyPressTriggerValidStates>
                <KeyPressTriggerValidState State="DefaultState" />
            </KeyPressTriggerValidStates>
        </KeyPressTrigger>
    </Triggers>
</SyntaxLanguage>
System.NullReferenceException: Object reference not set to an instance of an object.
at ActiproSoftware.SyntaxEditor.SyntaxLanguage._1(SyntaxLanguageCollection )
at _26._1(XmlTextReader , String )
at ActiproSoftware.SyntaxEditor.SyntaxLanguage._1(Stream , Int32 )
at ActiproSoftware.SyntaxEditor.SyntaxLanguage.LoadFromXml(String path, Int32 encryptionKey)
at ActiproSoftware.SyntaxEditor.Document.LoadLanguageFromXml(String filename, Int32 encryptionKey)
at actiprotest.Form1.Form1_Load(Object sender, EventArgs e) in c:\temp\foo\actiprotest\actiprotest\form1.cs:line 29
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
It's probably because you didn't define any lexical states or patterns. Most user errors in the XML definitions fail more gracefully and give a lot of info but this one must have slipped through the cracks.


Actipro Software Support

Posted 19 years ago by Chris Sells
Avatar
So what's the minimum legal language definition file?
Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
The language definition has to tell the lexical parser how to parse so at a minimum you need a DefaultState and several pattern groups. Plus you need Styles to set when each pattern group is matched.

If you're starting new, I'd recommend copying one of our language defs and change it to fit your needs. The BatchFile one is able as simple as a language definition can be so that's probably a good starting point.


Actipro Software Support

Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Also, in the Documentation, look at the "XML Language Definition Specification" section. Starting at the SyntaxLanguage tag, you can see exactly what tags are optional and required. Then go down through each tag. It's pretty thorough.


Actipro Software Support

The latest build of this product (v24.1.0) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.