MapInfo Pro Developers User Group

Expand all | Collapse all

MapBasic IDE

  • 1.  MapBasic IDE

    Pitney Bowes
    Posted 04-04-2019 17:39
    Edited by Bob Fortin 04-04-2019 18:08
    Periodically there are discussions in our community about the MapBasic 'IDE'.

    It is outdated but functional. The MapInfo Pro development team is reluctant to divert our limited resources into developing and maintaining a more modern IDE, which we give away for free.

    Here is a possible approach to remedy this situation.

     

    If we can officially or unofficially support an extension to a full featured IDE, we can give MapBasic developers the kind of tool and development experience they expect and deserve.


    One good choice for this could be Visual Studio Code.

    If is freely available, open source, and highly extensible.

     

    Try out this visual studio code language extension we have created for the mapbasic language.

    Currently it supports syntax highlighting and some snippets along with a build task for compiling and linking.

     

    We would even consider making the language extension as open source to collaborate with our passionate developer community.

    The potential is there for much more. Anyway give it a try to see what you think.

     

    You can get visual studio code here for free:

    https://code.visualstudio.com/download

     

    To install the extension, click on the extensions button on the left and then choose Install From VSIX from the options menu as shown.

     

    cid:<a href=image002.png@01D4E890.BA4E8630" src="https://higherlogicdownload.s3.amazonaws.com/PITNEYBOWES/MessageImages/TinyMce/dcbfbccf-94c2-4def-9a43-9fb8ce6ce9d5.jpg" border="0" v:shapes="Picture_x0020_2" />

     

    To use. Open up the folder where your mapbasic application lives.

    For example c:\program files\mapbasic\samples\animator

     

    You should be able to see syntax highlighting and some snippets.

     

    To use the build task, you currently have to copy the tasks.json file from the language install folder into the .vscode folder in your application folder.

    For example copy %USERPROFILE%\.vscode\extensions\pitneybowesmapinfo.mapbasic-0.0.8\tasks.json to  c:\program files\mapbasic\samples\animator\.vscode\tasks.json

     

    Then you can use the build task ( Ctrl+Shift+B ) to build your project and see any errors in the problems window (Ctrl + Shift +P).

    The build tasks calls mapbasic with either the mapbasic files in your folder, or if you have a project file (.mbp) it calls mapbasic with the modules listed in there and also passes the link flag to mapbasic.

    Note that if there is a .mb file with the same name as the module it will try to compile it, but if there is no mb file it uses the .mbo.

    Also note that mapbasic does not remove the previous .mbo when a compile has errors.

     

    So it can build the whole project at once.


    Of course you need to have MapBasic installed for the build task to work.
    The build task tries to locate mapbasic via the registry (HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\mapbasic.exe)
    or the MAPBASICEXE environment variable.
    You can also modify the task.json to pass the path to mapbasic.exe as an additional argument.

    Please reply with your thoughts on this.
    Is it a good idea? Would you use it? Would you contribute?
    Even better, give it a try first.

    -Bob



    ------------------------------
    Bob Fortin
    Software Architect and Distinguished Engineer
    MapInfo Pro Development Team
    ------------------------------


  • 2.  RE: MapBasic IDE

    Pitney Bowes
    Posted 04-04-2019 17:55
      |   view attached
    ​Here is the extension. Extract it before following the instructions above.

    ------------------------------
    Bob Fortin
    Software Architect and Distinguished Engineer
    ------------------------------

    Attachment(s)

    zip
    mapbasic-0.0.8.vsix.zip   27K 1 version


  • 3.  RE: MapBasic IDE

    Posted 04-05-2019 02:13
    Hi Bob,

    Thanks for providing this.  I have been using Mustafa's IDE (https://mustafaozcetin.wordpress.com/mapbasic/mapbasicide-en/) for the past few years and it has worked well.  I have now downloaded and installed what you have provided here and am looking forward to trying it when I have the time.

    ------------------------------
    James Nolet
    Dooley Mitchell & Morrison Pty Ltd
    ------------------------------



  • 4.  RE: MapBasic IDE

    Posted 04-08-2019 10:11
      |   view attached
    Hi Bob,

    I've tried that but something is not working.
    VScode is not compiling the mapbasic files.
    If I compile the mb's with mapbasic then I can link in vscode, but if I don't have the mbo's it doesn't compile them and the link fail because they don't exist.

    Do I have to do something else?

    I've sent a printscreen with everything.

    Thanks.

    ------------------------------
    Nuno Seixas
    Buchanan Computing Ltd
    Shelton CT
    ------------------------------



  • 5.  RE: MapBasic IDE

    Posted 04-09-2019 08:40
    @Bob Fortin

    I managed to make it work copying the .mbp file to another folder and create another task to link everything.

    Other problem that I found out is when we have something like this in the code: a = "\"

    Everything after that get the same colour (like it everything is part of a string).

    Thanks.


    ------------------------------
    Nuno Seixas
    Buchanan Computing Ltd
    Shelton CT
    ------------------------------



  • 6.  RE: MapBasic IDE

    Pitney Bowes
    Posted 04-22-2019 20:10
    Hi Nuno,

    I am seeing the same thing with the "\"

    Hopefully we can get some more feedback on the interest in this idea, as I think it has great potential.

    -Bob

    ------------------------------
    Bob Fortin
    Software Architect and Distinguished Engineer
    ------------------------------



  • 7.  RE: MapBasic IDE

    Posted 12-23-2019 02:45
    Good morning Bob,

    will there be an updated VS-Code-language file for the new v2019 Version of MapBasic/MiPro?
    Would be great if there is, - the MapBasic IDE hasn't been updated since 4 years now, so some commands might be missing by now.

    Thanks and: Merry Christmas!

    Stefan


  • 8.  RE: MapBasic IDE

    Pitney Bowes
    Posted 01-28-2020 17:55
    I will look to update this in the near future.

    ------------------------------
    Bob Fortin
    Software Architect and Distinguished Engineer
    MapInfo Pro Development Team
    ------------------------------



  • 9.  RE: MapBasic IDE

    Posted 01-28-2020 07:51
    Edited by Jonas Nordlund 01-28-2020 08:53
    Very interesting and exciting to see this!

    I think it's the correct approach to use existing IDE's to not have to reinvent the wheel, but rather use powerful extension systems like in VS Code! (great choice of editor)

    It basically "just" needs three things for me to think it being vastly more useful than the classic MapBasic editor: Syntax hilighting, a build command with a customizable path to the MapBasic compiler (we often have many versions installed in parallell) and a way to see compile output. I'll definitely get this and try it out when I have some spare time!

    If it's eventually deemed as mature enough I think it would be a great idea to offer it on the Visual Studio Marketplace for added MapBasic exposure and all too.

    Edit: BTW, hopefully the extension can somehow tell VS Code to not assume "C-like" escape sequences in the strings which is probably behind the "\" bug. :) (treating the \" compound as an escaped quotation mark rather than a backslash and a string terminator, so then it colors it as unterminated)


  • 10.  RE: MapBasic IDE

    Pitney Bowes
    Posted 01-28-2020 17:56
    I have been thinking about open sourcing it so others can extend and improve it.

    ------------------------------
    Bob Fortin
    Software Architect and Distinguished Engineer
    MapInfo Pro Development Team
    ------------------------------



  • 11.  RE: MapBasic IDE

    Pitney Bowes
    Posted 02-18-2020 15:55
      |   view attached
    Attached  is the latest version of the Visual Studio code MapBasic language extension. It really has not changed much. I added a few new keywords which were added in Pro 2019. The instructions above for using it still hold. The name of the helper exe has changed so if you have an old tasks.json file you will need to update it.

    I have added the source code to GitHub here: https://github.com/bobfortin64/mapbasic-vscode

    I am hoping others will want to join in to enhance and fix any issues such as the syntax highlighting issue.

    ------------------------------
    Bob Fortin
    Software Architect and Distinguished Engineer
    MapInfo Pro Development Team
    ------------------------------

    Attachment(s)

    zip
    mapbasic-0.0.9.vsix.zip   283K 1 version