Default Intelliprompt handling?

SyntaxEditor for Windows Forms Forum

Posted 14 years ago by Nels Olsen
Avatar
I'm starting to evaluate Actipro SyntaxEditor, and I'm confused about how to get the "IntelliPrompt" feature to work. I'm looking at the sample C# editor application, and all it shows is a "fake" IntelliPrompt scenario where an editor_KeyTyping event handler forces hard-coded text to appear when it detects a "." after the specific word "Invalidate".

I expected to be able to assign a language, source text, and DLL references to SyntaxEditor.Document, and it would provide "standard" intellisense. I don't see where to assign DLL references.

How is this done? If we have to do everything ourselves -- detecting keystrokes like "." and "(", examining the surrounding symbols, loading "IntelliPrompt" dropdown lists with possible choices from type members discovered through reflection, etc. even for standard languages like C#, we will most likely end up forgetting about the whole thing. Features like syntax coloring, outlining, etc. are nice, but Intellisense is the real feature affecting productivity. If that isn't easily configured "out of the box", we'll most likely just forget the whole thing ...

- Nels

Comments (8)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Nels, sorry but right now we provide all the user interface features for IntelliPrompt and helpers to populate the user interface but you do have to determine what to populate it with.

A goal for our 4.0 version is to make advanced language-specific parsers that will support "out-of-the-box" IntelliPrompt while typing.


Actipro Software Support

Posted 14 years ago by Nels Olsen
Avatar
OK, I found the helper method IntelliPrompt.MemberList.AddReflectionForAssemblyNamespacesAndTypes. It's not a problem to call that -- we need to tell the SyntaxEditor what the context of available types is somehow.

However, when I call it, I get a NullReferenceException. It would be nice to get an exception telling me what I haven't initialized properly ...

Assuming I "register" the exposed types and namespaces successfully, will the SyntaxEditor then automatically popup a member list with the correct contents when someone types "myObject." in the editor? Or do I also have to check for "." being typed myself, somehow figure out what the token preceding the "." is, open a member listbox , and manually populate it appropriately?

- Nels

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I can help you with the exception if you post your code. Also the documentation topic on the member list should help with those methods, so read that carefully since it might help you solve the problem, along with looking at our sample.

You need to figure out from your app's context what to pass to the reflection helper methods but once you do, they take care of everything including icons, descriptions, and all the member list UI.

So you'd want to figure out what type myObject is and then pass that Type and indicate that you want public instance members, etc. to the reflection method. Then SyntaxEditor will take over from there and populate the items. All you have to do is show the member list.


Actipro Software Support

Posted 14 years ago by Nels Olsen
Avatar
Here's the code I'm using, which gets executed when the referenced assemblies are initially set or changed:

// Prepare Intelliprompt member info

StringCollection exposedNamespaces  = new StringCollection();

IntelliPromptNamespaceAndTypeFlags[] defaultFlagsArray =
    new IntelliPromptNamespaceAndTypeFlags[]
    {
        IntelliPromptNamespaceAndTypeFlags.NamespacesAndTypes |
        IntelliPromptNamespaceAndTypeFlags.Public
    };

IntelliPromptMemberList memberList =
    this.userScriptTextBox.IntelliPrompt.MemberList;

memberList.Clear();
foreach (Assembly assembly in exposedAssemblies)
{
    exposedNamespaces.Clear();

    foreach (Type exposedType in assembly.GetTypes())
    {
        if (!exposedNamespaces.Contains(exposedType.Namespace))
        {
            exposedNamespaces.Add(exposedType.Namespace);
        }
    }

    try
    {
        memberList.AddReflectionForAssemblyNamespacesAndTypes(
            new Assembly[] {assembly},
            defaultFlagsArray,
            exposedNamespaces,
            null,
            false);
    }
    catch (Exception x)
    {

        ocExceptionManager.HandleException(
            new ocException(
                ocTextHelper.Localize(
                    "Failed to register assembly '{0}' with IntelliPrompt",
                    assembly.GetName().Name),
                x),
            ocExceptionResponse.LOG);
    }

}
A few calls to the helper succeed, but most fail with NullReferenceException.

Assuming we purchase a site license for SyntaxEditor, do you offer services like on-site Actipro consultants/trainers? One or two days of that would really get us rolling, so the expense would be worth it ...

- Nels

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
The problem here is that you are putting some null references in the exposedNamespaces collection. You shouldn't add nulls into that collection. Then it will work.

Sorry we don't offer on-site trainers but we can help via email and forums. As you can see from forum postings, there's a lot of activity here.


Actipro Software Support

Posted 14 years ago by Nels Olsen
Avatar
OK, I fixed the problem passing in null namespaces. Thanks!

The big issue that remains is how to determine the System.Type of someToken to the left of the "." after the user types "someToken." I see now that I must figure that out myself tell SyntaxEditor the answer, and call the reflection helper method each time the MemberList is invoked (I thought I just needed to call it once with all exposed types, and SyntaxEditor did the rest).

Are there any examples in the documentation or in the sample C# application to do realistic population of an IntelliPrompt MemberList? The only one I saw was fake (it just shoved in hard-coded text) and is of no use.

- Nels

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
It sounds like you understand it correctly. Again, ideally for version 4.0 we'll have a way to be able to automate a lot of this.

Right now the documentation and the sample app are the only samples. The sample project does show how to work with namespaces (like "System.Drawing.") and static type members, but it doesn't show instance type members. Those require a lot more parsing of the tokens, and unfortunately we don't have a real world sample available for that right now.


Actipro Software Support

Posted 14 years ago by billb - Software Craftsman, Yye Software
Avatar
And I'd like to be first in line for that upgrade. Just tell me when its ready and who and how much I make the check out for. (drooling) :>

Translation: I'm really looking forward to it.

Keep up the good work.
The latest build of this product (v2020.1 build 0400) was released 2 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.