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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Change language syntax highliting on the fly for same file?

Thread ID:

Created:

Updated:

Platform:

Replies:

96406 Sep 10,2010 05:04 PM UTC Sep 15,2010 05:54 AM UTC Windows Forms 3
loading
Tags: EditControl
Administrator [Syncfusion]
Asked On September 10, 2010 05:04 PM UTC

Hello, I have the following problem with the Editor control(latest release).

When I initialize control, I apply some language to it. For example, VB.

this.edtCodeEditor.Configurator.Open(configFile);
this.edtCodeEditor.ApplyConfiguration(KnownLanguages.VBNET);

after that, I set Text property with some code.

After that, selecting some radio button, I'd like to have the same text highlighting as C#:

this.edtCodeEditor.ApplyConfiguration(KnownLanguages.CSharp)

But C# highlighting is not applied, because the default name of my file (which does not exist really, only in the editor) is Untitled.vb.
(If I starts with CSharp configuration, I accordingly have Untitled.cs and can't apply VB.Net syntax).


What is the simplest method to change syntax highlighting without loading another file with another extension.


Regards


Lingaraj S [Syncfusion]
Replied On September 14, 2010 12:05 PM UTC

Hi,

Thank you for your interest in Syncfusion products.

We are unable reproduce the mentioned issue in EditControl when change the Configuration language for Editor. We have tested the issue with simple sample and attached in following link.
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=SampleTest-1437106584.zip

Please have look at the above sample and let me know if you still face the issue. Could you please try to reproduce the issue in above sample that could be helpful for us to provide a better solution?

Regards,
Lingaraj S.


Administrator [Syncfusion]
Replied On September 14, 2010 02:49 PM UTC

yes, you're right, my example was not correct enough.
I'm attaching my sample now.

The steps are:
1. I add Editor, in Form_Load I set this.editControl1.ApplyConfiguration(KnownLanguages.VBNET);

2. I have button named C#, in OnClick method I write the following:

string custCode = "//**************************************************\r\n";
custCode += "// Custom C# code for " + "\r\n";
custCode += "// Created: " + System.DateTime.Now.ToString() + "\r\n";
custCode += "//**************************************************\r\n";

//this line is for show that in fact syntax is VB
custCode += "'this line is for show that the syntax is not shown correctly \r\n";
custCode += "Imports System\r\n";
custCode += "using System;\r\n";


this.editControl1.Text = custCode;
this.editControl1.ApplyConfiguration(KnownLanguages.CSharp); // won't be c#



So, I add some text and set configuration to the c#.
When I press this button, syntax highlighting won't change to C#.


I can set configuration before setting the text, in this case, C# will be shown correctly.

But in this case, if I click another button - VB.NET, where configuration is changed to the VB.NET, syntax will remain C#.





SampleTest_a3d0f97a.zip

Lingaraj S [Syncfusion]
Replied On September 15, 2010 05:54 AM UTC

Hi,

Thanks for the update.

We usually share general informations alone on Community Forums, for issue related queries you can use our Direct Trac support at the following link,

http://www.syncfusion.com/support/directtrac

Please let us know if you have concerns on this,

Regards
Lingaraj S.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;