In this tutorial, we’ll write an editor for a subset of PlantUML, as an extension to Visual Studio Code. However, we won’t start from scratch like

Writing an Editor for PlantUML

submited by
Style Pass
2021-07-19 22:30:03

In this tutorial, we’ll write an editor for a subset of PlantUML, as an extension to Visual Studio Code. However, we won’t start from scratch like most tutorials do (including our own on implementing high-quality code completion in VSCode with ANTLR and the Language Server Protocol). Instead, we’ll use this example to show how we typically work, with the hope of giving an idea of what language engineering is in practice.

PlantUML is a tool to author UML diagrams using plain text. With it, we can describe diagrams of several kinds (including class diagrams, sequence diagrams, activity diagrams, and others) using a syntax that resembles pseudo-code, or what one would write in words and symbols on a piece of paper.

To edit PlantUML files, we can use any text editor. However, as we’ve often said in other articles, using an editor that understands the language being written has several advantages. This “language intelligence” allows for features such as syntax highlighting, real-time error reporting, and code completion. The code becomes easier to read, write, and maintain. New users can learn and become proficient more quickly.

PlantUML is also interesting because as a language it’s not as formally strict as most programming languages and DSLs; it doesn’t have a formal grammar and it’s meant to be embedded in any plain text document. We’ll see how this and other design decisions in the language can impact the effort required to write a good editor for it.

Leave a Comment