• Welcome to TodayPlus Boards v2.
 

Text editor with syntax highlighting

Started by tree99, February 04, 2005, 08:18:46 PM

Previous topic - Next topic

tree99

I have searched the forum for this subject and it is mentioned a little in the past under other topics, but I have not seen anything specific on this matter.
   I have been looking at some free text editors that do syntax highlighting and code indenting.  They come with preconfigured  preferences to highlight for common programming lanquages  (htm, perl,xml,pascal,etc.)  Some of them offer the ability to create your own preferences for uncommon languages, like TodayPlus skins, and also let you create bookmarks to specific lines of code.  The beauty is that the highlighting and indent features do nothing to the text files, they only  effect the display in that program.  I have seen some that will autofill when you type in code.  This might allow for the automatic insertion of 'else' and 'endif' when you type 'if', a helpful reminder to include the entire statement.

I have started to play with a simple one that only allows for custom highlighting of text strings.  It is called rsEdit.
I have set up highlighing for: // ; == ; if ; else ; endif ; region ; storevar ; var.  It would be much more helpful to find an editor with custom syntax highlighting so that I can set up code matching.  The program would then let me know which 'endif' goes with which 'if'

Some that I have found are, rsEdit, notepad2, Crimson Edit, there are also many more.

Have any of you used any of these kinds of programs?   Do you recommend one in particular?

Thank you, in advance.
-tree99


here is a screen capture of rsEdit, I have only set up display prefs for a few codes:

Broesel

I'm using an Editor called SuperEdi, where you allso can use
syntaxhighlighting.

Edit: It's freeware and you can get it here:
http://www.wolosoft.com/de/superedi/

Greetings Broesel

Timmy

Broesel,

I've downloaded the program you mentioned immediately, and gave it a look and a try.

Question: how did you get pruple for calcvar/var, and red for endif ?? (If and else are red, but endif remains black. I have clicked: Format --. File Type --> Java.

Timmy
Toshiba e750BT, WM 2003, Today Plus 0.11.0, WISbar Adv, Agenda Fusion, Pocket Slides, TomTom

Broesel

Quote from: "Timmy"Broesel,

I've downloaded the program you mentioned immediately, and gave it a look and a try.

Question: how did you get pruple for calcvar/var, and red for endif ?? (If and else are red, but endif remains black. I have clicked: Format --. File Type --> Java.

Timmy

Timmy, I made en extra definition for txt files, so that if you read a skin
it automatically will be displayed right, I'm looking for the definition-files
and then maybe putting it here in the forum.

Broesel

Timmy

Quote from: "Broesel"
Quote from: "Timmy"Broesel,

I've downloaded the program you mentioned immediately, and gave it a look and a try.

Question: how did you get pruple for calcvar/var, and red for endif ?? (If and else are red, but endif remains black. I have clicked: Format --. File Type --> Java.

Timmy

Timmy, I made en extra definition for txt files, so that if you read a skin
it automatically will be displayed right, I'm looking for the definition-files
and then maybe putting it here in the forum.

Broesel

Broesel,

That would be nice! I think you have made SuperEdi very readeble by the colours you use in SuperEdi. If you succeed in getting the right defenition file, can you, please, also give a simple advice how to use that file in SuperEdi???

Thanks!
Timmy
Toshiba e750BT, WM 2003, Today Plus 0.11.0, WISbar Adv, Agenda Fusion, Pocket Slides, TomTom

Broesel

Quote from: "Timmy"
Broesel,

That would be nice! I think you have made SuperEdi very readeble by the colours you use in SuperEdi. If you succeed in getting the right defenition file, can you, please, also give a simple advice how to use that file in SuperEdi???

O.k. here they come:
Copy the files text.syn and text.col in the syntax-folder of your
Superedi-Installation (f.ex. Programme\Wolosoft\Superedi\Syntax

They are textfiles and can be worked with by Superedi itself. They are
really simple and you will see, how they work, when you read them.

Then rightclicking on the Skintxt-file --> open with superedi will show you
the result.

Broesel

Timmy

Quote from: "Broesel"O.k. here they come:
Copy the files text.syn and text.col in the syntax-folder of your
Superedi-Installation (f.ex. Programme\Wolosoft\Superedi\Syntax

They are textfiles and can be worked with by Superedi itself. They are
really simple and you will see, how they work, when you read them.

Then rightclicking on the Skintxt-file --> open with superedi will show you
the result.

Broesel

Broesel,

Thanks for the two files!!!

I've done everything you told me to do. I even saw that the textfiles are easy to change to everybody's own wishes. But I still have one problem: opening my skinfile with SuperEdi don't give the colours... So I think you changed some other settings in SuperEdi?!? Do you know what settings you've changed in the original version?!?

Thanks!
Timmy
Toshiba e750BT, WM 2003, Today Plus 0.11.0, WISbar Adv, Agenda Fusion, Pocket Slides, TomTom

Broesel

Quote from: "Timmy"
Broesel,

Thanks for the two files!!!

I've done everything you told me to do. I even saw that the textfiles are easy to change to everybody's own wishes. But I still have one problem: opening my skinfile with SuperEdi don't give the colours... So I think you changed some other settings in SuperEdi?!? Do you know what settings you've changed in the original version?!?

Thanks!
Timmy

Sorry, did not remember this.
In Superdi under Extras / Einstellungen you have to define that files.
Take a look at the screenshot, this is, how mine is set up.

Broesel

Timmy

Broesel,

Thanks!!! That was the last step I'd had to take. Everything works fine now!

Thanks again!
Timmy
Toshiba e750BT, WM 2003, Today Plus 0.11.0, WISbar Adv, Agenda Fusion, Pocket Slides, TomTom

tree99

Broesel,

Thanks for your response.  I tried SuperEdi but couldn't get it to code match for tracing if...else...endif statements.   It does a very nice job with the syntax coloring though.

Anyone else who is interested in a great text editor:
I found a very nice program to do both the code matching, code autofill and syntax highlighting.  It is called NotePad++.   I LOVE IT!  Ther website has a lot more screenshots.
http://notepad-plus.sourceforge.net/uk/about.php

Matching works flawlessly, NotePad++ had no problems with nested if...else...endif statements.  The matching allows me to 'roll up' sections of code.   To make sections disappear that I am not working on and to trace if...else...endif statements.   That way I don't have to scroll through so much code when I need to jump back and forth.   Creating bookmarks is another great way to jump back and forth.

NotePad++ also allows me to make a code list for autofill.  I am creating this list from the T+ reference html file.  This helps me make sure I include all the parameters for each function and type the numbers in the correct order.  This is a great reminder for what the numbers refer to.  It also lets me start typing a few characters and then let the computer finish typing the rest of the code.

Here is an animated gif of the program you can see colored syntax and code matching.  Take a look at how I call roll up sections of code.
As you can see the matching of if to endif worked great,  region to endregion did not.  The problem was that region is used in some if statements and so this confused the matching.  The program is case sensitive so I tried to make region into REGION unless it was an argument in another function.  This worked great for matching but made my skin malfunction.  I guess T+ is case sensitive for the region code.  Funny thing, it was fine to make region all caps for some regions, but not all.  To overcome this problem I made sure that all of my REMs were '///' in stead of just '//' and changed the comment setting accordingly.  Then I created a match for //region and //endregion in the setup and added them in the skin file near the //region and //endregion codes.  That worked for matching and T+ didn't mind the odd coding since //region is just REMmed out. Anyway here is the gif.

By the way this is FREEWARE/DONATIONWARE!  They are also improving it all the time.

Broesel

Thanks tre99 for this nice finding, especially the code-tracing-feature
makes it worth to give it a try.  :)

Regards Broesel

tree99

Broesel, these files will help you get started.  They go here:

C:\Documents and Settings\USERNAME\Application Data\Notepad++\userDefineLang.xml

and here:

C:\Program Files\Notepad++\plugins\APIs\todayplus.api

The code-tracing is so helpful.  A few years ago( >10 years I think)  I took a C++ class.  I haven't done any programming since, so I remember close to nothing.  I do remember that using a compiler, which helped you trace your code, made things a lot easier than trying to do this stuff with a word processor.

Timmy

Tree99,

Thank you for your tip! This evening I'll give this program a try.

Thanks!
Timmy
Toshiba e750BT, WM 2003, Today Plus 0.11.0, WISbar Adv, Agenda Fusion, Pocket Slides, TomTom

Timmy

Quote from: "tree99"Broesel, these files will help you get started.  They go here:

C:\Documents and Settings\USERNAME\Application Data\Notepad++\userDefineLang.xml

and here:

C:\Program Files\Notepad++\plugins\APIs\todayplus.api

The code-tracing is so helpful.  A few years( >10 years I think)  I took a C++ class.  I haven't done any programming since, so I remember close to nothing.  I do remember that using a compiler, which helped you trace your code, made things a lot easier than trying to do this stuff with a word processor.

Tree99,

I've downloaded Notepad++ ànd your two files. I've placed these two files in the adviced directories and tested Notepad++

What I think of Notepad++ ? Well, it's a very helpfull program!!! I specially like the if-else help this program gives AND the possibility of printing my skintext in the same colours as Notepad++ shows them AND the easy way of placing/deleting markers.

So, thanks again for your good TIP !


To change the things to my own wishes, can you teach me for example one thing: changing 'else' into green (but not the bold from 'if' and 'endif'). I think I have to use the useDefineLang.xml? But I also saw the word 'else' was in TodayPlus.api?

Timmy
Toshiba e750BT, WM 2003, Today Plus 0.11.0, WISbar Adv, Agenda Fusion, Pocket Slides, TomTom

tree99

-Your're Welcome.  I am just glad that I can finally contribute something useful.  I have only been taking from the forum so far, it's nice to give back.

Keep in mind that this program, like all the other syntax text editors, require you to make custom language files.  Those are the files I sent you.  todayplus.api & userDefineLang.xml.  They are not complete in their adjustment, I have missed some codes and am in the process of filling in the rest.  I have most of them inputed and just wanted to help you get started.

 The file todayplus.api needs to be edited with a text editor.  It is simply a text list of codes that your language uses.  I inputed most of these codes as you would see them in a completed skin e.g. button, ; calcvar,.  After trying this out I realized how often I check the reference file for correct syntax. So I started to edit the .api file to have the codes be like this:
button,<x>,<y>,<width>,<height>,<target region>,<action>,<data>,<regions to update>
&
calcvar,var<x>,<system value>
&
calcvar,var<x>,<operation>,<value1>,<value2>
You can decide which is best for you.  Maybe I will list them both ways.

The file userDefineLang.xml is changed by the program itself.  You don't need to do it with a text editor.  Just click the menu: View\User Define Dialog.  A window with tabs and buttons will pop up for you to adjust the keywords, folder words. etc., and the colors of such.  The NotePad++ website is helpful too.