1 minute read

In this post, I will show an extension to get syntax highlighting and code folding working for Notepad++. This the first post in a series on using external editors with the AnyBody Modeling System.

Why another editor?

I shall be the first to admit that the editor in the AnyBody Modeling System (AMS) can feel very limited at times. It does have some crucial features like integration with the model tree. Even though some of these functions are indispensable when debugging models, the features of the editor in itself are pretty basic.

So when I write, edit or format AnyScript code I look for something more productive. Luckily, there are much more powerful alternatives available. Maybe you have heard about trending editors like Atom, Sublime Text, VS Code? Or perhaps a bit older options like notepad++? All are text editors which many developers couldn’t live without.

Modern text editors have become popular for very good reasons. They are fast, lightweight, and powerful and they are not limited to a particular programming language like most integrated developer environments (IDE). If you ever used some of these powerful text editors, it can be hard to live without the features they provide.

AnyScript support in Notepad++

Notepad++ was my favorite text editor for many years and I often still use it. It is fast and works well on Windows. To enable AnyScript support in Notepad++ you need to the install AnyScript language extension.

You can find the extension on GitHub, or download it here directly:

Download AnyScript Notepad++

Save the file AnyScript.xml to your computer. Open Notepad++ and select the menu: “Language”->”Define your language” and click import…

image

With the extension in place AnyScript code will highlight correctly, and braces will match up. And it is possible to collapse pairs of braces {/}, as well as pairs of #if/#endif. That is huge advantage when working with very big AnyScript files.

Why is Notepad++ usefull

The main benefits are:

  • Effective search replace with regex
  • Code folding
  • Syntax highlighting
  • Macro recording/playback
  • Multi editing
  • Document map

To really understand the power of notepad++ see this example of column mode editing:

column mode editing
The ability to write at multiple cursors or select a column of text is fantastic.

Leave a comment