Can I prevent automatic case changing in editor?

Posts   
 
    
jovball
User
Posts: 441
Joined: 23-Jan-2005
# Posted on: 23-Feb-2012 12:40:36   

I have some lpt templates that are generating ASPX and HTML markup. In the VB.NET template, the LLBLGen template editor will automatically capitalize words that are VB.NET keywords even when they are not inside a code block. The result is that HTML attributes are capitalized even though they should be lower-case.

My only fix at this point is to use "Visual Notepad" and change the case on those words. I have to do that after I make any change in the LLBLGen editor.

See the words "for" and "class" below. They should be in lowercase.


<label For="txt<%= field.Name %>" Class="fieldCaption captionOffset">   
<%= SD_VB_Utils.GetFieldCaption(field) %>
</label>    

Since VB is not case-sensitive, I'd probably prefer if the editor just left the case alone everywhere. It would be great if it could ignore any text that is outside of a code block.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 23-Feb-2012 19:51:47   

In the editor there is an Output language output. Set it to HTML, that way the editor will help your to write html.

David Elizondo | LLBLGen Support Team
jovball
User
Posts: 441
Joined: 23-Jan-2005
# Posted on: 24-Feb-2012 02:15:27   

I don't think that helps me because the output language setting isn't "sticky." As soon as I re-open the file in the editor, the output language defaults back to VB.NET and the "keywords" immediately change case.

That would work if that setting was sticky. It would probably have to be tied into the template bindings file with an additional attribute as shown below.

<language name="VB.NET"> <templateBinding templateID="SD_ASPX_GridView" filename="WebControls\Net2.x\VB.NET\ASPX_GridView.lpt" templateLanguage="VB.NET" outputLanguage="HTML" />

Let me know if I'm missing something that is already in there. I've certainly done that enough in the past.

Walaa avatar
Walaa
Support Team
Posts: 14986
Joined: 21-Aug-2005
# Posted on: 24-Feb-2012 10:52:03   

I believe that VB.NET is case sensetive. Although the IDE is not as it corrects your casing on the fly. So I guess if you compiled the generated code outside the the IDE it will fail, if you have case issues.

Am I right?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39760
Joined: 17-Aug-2003
# Posted on: 24-Feb-2012 11:07:24   

@Walaa, VB.NET is case INsensitive, the language definition for VB.NET for the editor control has a feature which auto-corrects strings.

jovball wrote:

I don't think that helps me because the output language setting isn't "sticky." As soon as I re-open the file in the editor, the output language defaults back to VB.NET and the "keywords" immediately change case.

That would work if that setting was sticky. It would probably have to be tied into the template bindings file with an additional attribute as shown below.

<language name="VB.NET"> <templateBinding templateID="SD_ASPX_GridView" filename="WebControls\Net2.x\VB.NET\ASPX_GridView.lpt" templateLanguage="VB.NET" outputLanguage="HTML" />

Let me know if I'm missing something that is already in there. I've certainly done that enough in the past.

the value for name in the language tag should be 'HTML'. the templateLanguage attribute describes the language of the logic inside the template. the language tag describes the output language and is used for filtering.

Sometimes this is too strict, as it's also used for filtering. In that case you can edit the vb.net language xml file if you want to get rid of this 'feature' of the text editor control. In the file SD.VBDotNet.xml in the 'LanguageDefinitions' folder, replace CaseSensitivity="AutoCorrect"

into an empty string (no quotes), so effectively removing CaseSensitivity="AutoCorrect"

this should disable the 'auto-correct'. (just do a global replace in the file, match case)

We'll disable it in v3.1's next build and v3.5's language file, as it is indeed annoying.

Frans Bouma | Lead developer LLBLGen Pro
jovball
User
Posts: 441
Joined: 23-Jan-2005
# Posted on: 24-Feb-2012 13:19:42   

Frans:

Removing CaseSensitivity="AutoCorrect" is what I needed.

I like the idea of having it disabled by default. If people want the keywords capitalized just because they like the visual result, it's not that hard to type them that way.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39760
Joined: 17-Aug-2003
# Posted on: 24-Feb-2012 13:27:39   

jovball wrote:

Frans:

Removing CaseSensitivity="AutoCorrect" is what I needed.

I like the idea of having it disabled by default. If people want the keywords capitalized just because they like the visual result, it's not that hard to type them that way.

Exactly simple_smile

Disabled in next build of v3.1 and v3.5 (beta)

Frans Bouma | Lead developer LLBLGen Pro