MapBasic Syntax Highlighting and Auto Completion in Notepad++

410 views
Skip to first unread message

e.j.h.polle

unread,
Aug 5, 2008, 11:52:51 AM8/5/08
to MapInfo-L
Hello Listers,


For all of you who use Notepad++ to create their MapBasic
applications:

new files are available for MapBasic Syntax Highlighting and Auto
Completion in Notepad++: userDefineLang.xml and mapbasic.api or
mapbasic.xml. I created those files for my own personal use, but then
I thought I might share them as well;-) They have been updated for
MapInfo Professional and MapBasic version 9.5.

If you upgraded already to the newest version of Notepad++ (version 5,
released July 2008), then you will have discovered that auto
completion with the good old mapbasic.api does not work anymore:-( The
file should now be XML based... That's why I converted the
mapbasic.api to mapbasic.xml.

You can find the files - along with some other tips 'n' tricks - on
the following location: http://www.twiav.nl/php/mapbasic.php

Hope to be of help. If any comments, please let me know.

Cheers,


Egge-Jan Pollé

Duri

unread,
Aug 5, 2008, 10:21:00 PM8/5/08
to MapInfo-L
Thanks i'll give it a go should save me lots of time :)

Duri

unread,
Aug 6, 2008, 1:17:13 AM8/6/08
to MapInfo-L
Thanks heaps just tested it and it seems to work seamlessly
> > Egge-Jan Pollé- Hide quoted text -
>
> - Show quoted text -

Mats Elfström

unread,
Aug 6, 2008, 3:31:04 AM8/6/08
to mapi...@googlegroups.com
Hi Egge-Jan!

Amazing! I just had to walk through your steps and it worked right away.
Many many thanks for this post.
I used to use UltraEdit but have dreaded to set it up for MapBasic
since my last workplace shift.
Also, I think the MB language file for UltraEdit is outdated.

Anyway, Notepad ++ plus MapBasic 8.5 works perfectly thanks to your
instructions.

May I make a couple of suggestions, though.

Emphasize that Notepad ++ cannot edit the xml-files. I fell into the
trap and the program offered no warning. My bad, but it may be made
clearer.

This is self evident, but you could point out that the file paths to
the MapBasic compiler and help file needs to be checked to fit each
users configuration.

Jacob Lanstorp provided an UltraEdit setup for linking MapBasic
projects as well. Would a similar setup work in NotePad++?

These are minor observations, you have done a great job and I hope you
will continue updating the files as MapBasic evolves.

Regards, Mats.E

2008/8/6 Duri <Duri.B...@gmail.com>:

Gajendra Salunkhe

unread,
Aug 6, 2008, 4:09:38 AM8/6/08
to mapi...@googlegroups.com
HI Egge-Jan Pollé

Thanks for the Link, I was trying to configure NotePad++ some time back but was not able to.

The only thing remaining is Configuring MapBasic Help with NotePad++. When I tried to install KEYHH from http://www.keyworks.net/KeyHHSetup.exe. Its giving a Virus error and some error message. Can you help me in this for this.

Regards
Gajendra Salunkhe

Rob Schneider - Aurchem Exploration

unread,
Aug 6, 2008, 10:36:58 AM8/6/08
to mapi...@googlegroups.com
Mats - I have just uploaded a new language file (MB90Wordfile.txt) for UltraEdit with some code folding settings, replacing the new one I uploaded a few months ago.
Also I used to dread the setup of the compiling but the instructions seem to appear more complicated than they are.
Cheers,
Rob

Mats Elfström wrote:


.

  

Andy Harfoot

unread,
Aug 6, 2008, 10:41:52 AM8/6/08
to mapi...@googlegroups.com
Hi Everyone,

Here are a couple more bits that I have found to be of use with
Notepad++, I've uploaded a zip with the files in to the Group Files area:
http://groups.google.co.uk/group/mapinfo-l/web/Notepad__%20extras.zip?hl=en

insertExt.ini - On my machine I have this file in the Notepad++
installation directory (C:\Program Files\Notepad++), it may also work in
the user directory as with the other custom files, but I haven't tried
this. This file configures the FunctionList plugin that usually comes
bundled with N++ and will allow you to display a list of subs and
functions in the active document and navigate between them. To see the
list, use the menu command Plugins > FunctionList > List... If the
command isn't there then you probably don't have the plugin - have a
look on the N++ website (http://notepad-plus.sourceforge.net/)

NPP_Compile_link_mbp.bat - Compiles and links from a MapBasic project
file. This can be installed by following Egge-Jan's instructions for
compiling from MapBasic, replacing references to Compile_MB.bat with
NPP_Compile_link_mbp.bat


Andy
--
Andy Harfoot

GeoData Institute
University of Southampton
Southampton
SO17 1BJ

Tel: +44 (0)23 8059 2719
Fax: +44 (0)23 8059 2849

www.geodata.soton.ac.uk

---------------------------------------
For further information about GeoData's
Training Courses, please visit:
www.gis-train.com
---------------------------------------


Lee Morris

unread,
Aug 6, 2008, 11:10:28 AM8/6/08
to mapi...@googlegroups.com
Hi Peeps

Does anybody have a syntax file for use within TextPad?

Thanks

Lee
The information in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. Any views or opinions expressed in this e-mail may be solely those of the author and are not necessarily those of Mouchel.
Mouchel Limited, Registered in England at West Hall, Parvis Road, West Byfleet, Surrey UK KT14 6EZ Registered No : 1686040

e.j.h.polle

unread,
Aug 6, 2008, 12:46:46 PM8/6/08
to MapInfo-L
Hi Andy,


Thanks for your additions. As you might have seen (;-)), part of my
tips 'n' tricks are based on tips you gave earlier on this list. If
you do not mind, I would like to add the tip about compiling and
linking from a MapBasic Project file as well - just to keep everything
together.

I am still fighting with this function list in Notepad++ though - I do
not understand this plugin Jens Lorenz created based as it is on
Regular Expressions.

Which version of this plugin are you using, 1.2 or 2.0? And how did
you get it to work?

Cheers,

Egge-Jan


On 6 aug, 16:41, Andy Harfoot <a...@geodata.soton.ac.uk> wrote:
> Hi Everyone,
>
> Here are a couple more bits that I have found to be of use with
> Notepad++, I've uploaded a zip with the files in to the Group Files area:http://groups.google.co.uk/group/mapinfo-l/web/Notepad__%20extras.zip...

Gentreau

unread,
Aug 6, 2008, 1:01:34 PM8/6/08
to mapi...@googlegroups.com

Nothing more recent than the one on their website.

http://www.textpad.com/add-ons/synh2m.html

Gentreau.

Rob Schneider - Aurchem Exploration

unread,
Aug 6, 2008, 1:11:15 PM8/6/08
to mapi...@googlegroups.com
My ultraedit one is similar, you can probably cut 'n' paste, and with a little effort have all the newer keywords.

Gentreau wrote:
---------------------------------------





The information in this e-mail is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this email by
anyone else is unauthorised. Any views or opinions expressed in this e-mail
may be solely those of the author and are not necessarily those of Mouchel.
Mouchel Limited, Registered in England at West Hall, Parvis Road, West
Byfleet, Surrey UK KT14 6EZ Registered No : 1686040







.

  

Mike Taylor

unread,
Aug 6, 2008, 4:49:02 PM8/6/08
to mapi...@googlegroups.com

Here's the one that I use for textpad. It's quite out of date version wise
though.
mapbasic.syn

Andy Harfoot

unread,
Aug 7, 2008, 4:54:42 AM8/7/08
to mapi...@googlegroups.com, e.j.h...@gmail.com
Hi Egge-Jan,

Please go ahead and add the linking script to your site - it's put on
the list for anyone to use, and it's very useful to have a single site
to consolidate N++ tips as you have created. The MB help search using
KeyHH.exe will be very useful!

I am currently using N++ v4.5 with function list v1.2. I set it up by
creating two rules, one for subs and one for functions for the MapBasic
user defined language (which needs to exist already) - the regular
expressions are contained in the ini file that I posted previously
(though I've tweaked them a little below). Here is how I originally set
up one of the rules (the difference between them is the substitution of
'sub' for 'function')

If you are cutting and pasting from this post, note that I have added a
space in front of each regular expression. This leading space should not
be present when filling in the dialog box as this would certainly mess
things up. For example the first regular expression below begins with the ^

Function Begin: ^[ \t]*sub[ \t]+
This defines the start of a 'block' as a line beginning with zero or
more spaces or tabs, followed by the letters sub, then followed by one
or more spaces or tabs.

Function List Name: [a-zA-Z0-9_]+
The plugin expects the name to be on the same line as the sub keyword.
This regular expression follows on from the first, and catches a block
of one or more alphanumeric characters with no spaces - this text is
then displayed in the function list.

Function End: .*$
I think this allows for the existence of multi line function 'headers' -
not really applicable here, so this regular expression follows on from
the last and catches all remaining characters to the end of the line -
in MB this would be parameters, and thus these are not shown in the
function name in the list.

Separator Between: blank
No need for this in MB as far as I can see

Body Begin: blank
No need for this in MB as far as I can see

Body End: ^[ \t]*end[ \t]+sub[ \t]*
The end of the block is defined as a line beginning with zero or more
spaces or tabs, followed by the letters end, followed by one or more
spaces or tabs, followed by the letters sub, followed by zero or more
spaces or tabs.

The regular expressions here are slightly different from the ones in the
file I uploaded as in writing this I have thought of a couple of
instances that I hadn't considered - the use of keywords or variable
names beginning with 'sub', and the presence of a comment on the same
line as 'end sub'.

I hope this helps you make a bit more sense of the plugin.

Andy


e.j.h.polle wrote:
> Hi Andy,
>
>
> Thanks for your additions. As you might have seen (;-)), part of my
> tips 'n' tricks are based on tips you gave earlier on this list. If
> you do not mind, I would like to add the tip about compiling and
> linking from a MapBasic Project file as well - just to keep everything
> together.
>
> I am still fighting with this function list in Notepad++ though - I do
> not understand this plugin Jens Lorenz created based as it is on
> Regular Expressions.
>
> Which version of this plugin are you using, 1.2 or 2.0? And how did
> you get it to work?
>
> Cheers,
>
> Egge-Jan
>
>

Aladar

unread,
Aug 7, 2008, 9:07:58 PM8/7/08
to MapInfo-L
Hi Lee,

I'm usign Textpad as well

Here is a link

http://www.textpad.com/add-ons/files/syntax/mapbasic.zip

hth

Aladar

On Aug 7, 1:10 am, "Lee Morris" <lee.mor...@mouchel.com> wrote:
> Hi Peeps
>
> Does anybody have a syntax file for use within TextPad?
>
> Thanks
>
> Lee
>
>
>
> -----Original Message-----
> From: mapi...@googlegroups.com [mailto:mapi...@googlegroups.com] On Behalf Of Andy Harfoot
> Sent: 06 August 2008 15:42
> To: mapi...@googlegroups.com
> Subject: [MI-L] Re: MapBasic Syntax Highlighting and Auto Completion in Notepad++
>
> Hi Everyone,
>
> Here are a couple more bits that I have found to be of use with
> Notepad++, I've uploaded a zip with the files in to the Group Files area:http://groups.google.co.uk/group/mapinfo-l/web/Notepad__%20extras.zip...
> Mouchel Limited, Registered in England at West Hall, Parvis Road, West Byfleet, Surrey UK KT14 6EZ Registered No : 1686040- Hide quoted text -

Gentreau

unread,
Aug 8, 2008, 2:49:37 AM8/8/08
to mapi...@googlegroups.com


A slightly more existential question regarding syntax highlighting.

What's the best way to use it, how do you group keywords, constants,
operators etc so that the colouring is most effective?

Gentreau

Bill Thoen

unread,
Aug 8, 2008, 8:03:51 AM8/8/08
to mapi...@googlegroups.com
Gentreau wrote:
> A slightly more existential question regarding syntax highlighting.
>
> What's the best way to use it, how do you group keywords, constants,
> operators etc so that the colouring is most effective?
>

I use it simply to quickly see that I spelled the keywords correctly. I
only use a couple of colors as a consequence; blue for keywords and
green for comments.

- Bill Thoen

Reply all
Reply to author
Forward
0 new messages