We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Autocomplete / IntelliSense from external DLL

Hello,
we are using the EditControl as source code editor. In this source code editor the user can load external DLLs whose API he can use. Is there a way that the IntelliSense feature of the EditControl can read out all public members and associated comments? Or must really all items shown by the IntelliSense features be provided using an external XML file or via source code at compile time? One commonly used external DLL has thousands of public members so this would be quite a lot of work.

8 Replies

SK Senthil Kumaran Rajan Syncfusion Team March 26, 2015 06:00 PM UTC

Hi Torsten,

Thank you for using Syncfusion products.

We hope your requirement is to add the items in EditControl context choice from other class. The items from other class can be added into context choice by handling the ContextChoiceOpen event as shown in the below code snippets. We have also prepared the sample for your reference and this will be available in the below location.

Code Snippets[C#]:

private void editControl1_ContextChoiceOpen(Syncfusion.Windows.Forms.Edit.Interfaces.IContextChoiceController controller)

{

foreach (object items in employ.Name)

{

controller.Items.Add(items.ToString());

}

}

Sample Location : https://www.syncfusion.com/downloads/support/forum/118630/Intellisense1385814257.zip

Could you please check with attached sample and let us know the provided solution is helpful? If we misunderstood your query please provide some additional details about your requirement. this will be helpful for us to analyze and provide you a prompt solution.

Please let us know if you need further assistance.

Regards,

Senthil.



TS Torsten Schöning March 27, 2015 08:19 AM UTC

Hello,
thanks for your reply. But unfortunately you got me wrong.

If you are in Visual Studio and you add a reference to e.g. the Syncfusion.Edit.Windows.dll, you can use the IntelliSense features (Context choice and context prompt) for all classes and members in this DLL automatically. We want to implement similar functionality. So I'm looking to something like "controller.Items.AddFromDLL(@"C:\Syncfusion.Edit.Windows.dll")".

If this would not work we would need to implement several lines of code for each member in said DLL to obtain IntelliSense functionality. And it would not be possible that the user can use IntelliSense for DLL references he has added at runtime.

Hope this clarifies my question.

With best regards,
Torsten Schöning


TS Torsten Schöning March 27, 2015 08:54 AM UTC

OK, Microsoft itself states "The XML documentation comments are not metadata; they are not included in the compiled assembly and therefore they are not accessible through reflection." (https://msdn.microsoft.com/en-us/library/b2s063f7.aspx). So I assume that Visual Studio reads out the corresponding XMl files (e.g. Syncfusion.Edit.Windows.xml) for its IntelliSense functionality.

And I have now figured out that you provide an example how to use context choice and context prompt by parsing an external XML file. But in this example a special XML format is used.

So my question is: Do you also have an example of how to use context choice and context prompt with XML format generate by the .Net Compiler with the \doc option?

Sample of the format of such a XML file:
        <member name="M:Syncfusion.Windows.Forms.Edit.Utils.Serializers.FormatSerializationWriter.WriteDataToXml(System.Object)">
            <summary>
            Serializes given object.
            </summary>
            <param name="o">The object to serialize</param>
        </member>


AJ Ashwini Jaya Preetha Durai Samy Syncfusion Team March 30, 2015 01:08 PM UTC

Hi Torsten,

 

Thank you for your update.

 

We request you to confirm, if the reported requirement is to load intellisence items to EditControl, from external xml file.  If so, please make use of below code snippet to achieve this requirement.

 

Code snippet[C#]:

 

// Context Choice Implementation

private void editControl1_ContextChoiceOpen(Syncfusion.Windows.Forms.Edit.Interfaces.IContextChoiceController controller)

        {

            reader = new XmlTextReader(intellisensePath);

            while (reader.Read())

            {

                string itemname = "", tooltip = "";

                switch (reader.NodeType)

                {

                    case (XmlNodeType.Element):

 

                        if (reader.Name == "Items")

                        {

                            if (reader.AttributeCount > 0)

                            {

                                while (reader.MoveToNextAttribute())

                                {

                                    if (reader.Name == "Name")

                                    {

                                        itemname = reader.Value;

                                    }

                                    if (reader.Name == "Tooltip")

                                    {

                                        tooltip = reader.Value;

                                    }

                                    if (reader.Name == "Image")

                                    {

                                        controller.Items.Add(itemname, tooltip, this.editControl1.ContextChoiceController.Images[reader.Value]);

                                    }

                                }

                            }

                        }

 

                        break;

                }

            }

        }     

 

 

 

We have prepared a sample for your requirement and it can be downloaded from the following location.

 

Sample location: https://www.syncfusion.com/downloads/support/forum/118630/EditControlSample619030699.zip

 

Please look into the sample and kindly let us know if it helps you.

 

Please let us know if you need any further assistance,

 

Regards,

Ashwini



TS Torsten Schöning March 30, 2015 01:43 PM UTC

Hello,
yes, my requirement is to load intellisense items to EditControl, from external XML file, but from a XML file with a special format. I would like to use the XML documentation generated by Microsoft Visual Studio if one uses the /doc compilation switch.

I just wanted to know whether you have by any chance already a program available to load intellisense items from this *special* format before I start implementing it by myself.

Sample how one method is documented in such a XML file:
        <member name="M:Syncfusion.Windows.Forms.Edit.Utils.Serializers.FormatSerializationWriter.WriteDataToXml(System.Object)">
            <summary>
            Serializes given object.
            </summary>
            <param name="o">The object to serialize</param>
        </member>


SK Senthil Kumaran Rajan Syncfusion Team March 31, 2015 06:18 PM UTC

Hi Torsten,

Thank you for your update.

We would like to let you know that we have derived objects into Intellisense function of Edit control for below format. We have also prepared the sample for your reference and it can be downloaded from the below location.

Format
<param name="Charles">AAA</param>


Please refer the below code snippet to derive the object for intellisense for the above format.

reader = new XmlTextReader(intellisensePath);

while (reader.Read())

{

string itemname = "";

switch (reader.NodeType)

{

case (XmlNodeType.Element):


if (reader.Name == "param")

{

if (reader.AttributeCount > 0)

{

while (reader.MoveToNextAttribute())

{

if (reader.Name == "name")

{

itemname = reader.Value;

}

if (reader.Name == "name")

{

//To Derive Name from the format, <param name="Charles">DDD</param>, where Name = Charles

controller.Items.Add(itemname, this.editControl1.ContextChoiceController.Images[reader.Value]);

}

}

}

}

break;

case XmlNodeType.Text:

{

//To Derive text from the format <param name="David">AAA</param>, Where Text = AAA

controller.Items.Add(reader.Value);

}

break;

}

}



Sample Location : https://www.syncfusion.com/downloads/support/forum/118630/EditControlSample-601680142.zip

Could you please check with the provided sample and let us know whether the provided solution is helpful? If we have misunderstood your query could you please provide additional information about special format as you have mentioned in your previous update. This will be helpful for us to analyze and provide you a prompt solution.

Please let us know if you need further assistance on this.

Regards,
Senthil


TS Torsten Schöning April 2, 2015 08:09 AM UTC

Hello,
thanks for your clarifications.
Your code helped me to understand how we must proceed.
With best regards,
Torsten Schöning


SK Senthil Kumaran Rajan Syncfusion Team April 2, 2015 01:19 PM UTC

Hi Torsten,

Thank you for your update.

We are glad to hear that the provided solution meets your requirement.

Please let us know if you need any further assistance on this,

Regards,

Senthil


Loader.
Live Chat Icon For mobile
Up arrow icon