ESV — Editor Service Specification¶
The Editor Service (ESV) language is a declarative meta-language for configuring the editor services of a language.Most editor services are configured in an ESV file. This way the following editor services can be defined:
- Action Menus
- File Extensions
- Hover Tooltips
- On-Save Handlers
- Outline View
- Reference Resolution
- Stratego Strategies
- Syntax Highlighting
ESV files end with the
.esv extension, and are by convention placed in the
editor/ folder of a language project. Each ESV file defines a module for the file, followed by import statements and then the main configuration sections. Each section consists of a number of keys and values. For example, the following ESV code fragment configures the syntax highlighting for a language, based on the types of tokens:
module color colorer keyword : 153 51 153 identifier : black string : 177 47 2 number : 17 131 22 operator : black layout : 63 127 95 italic
By convention, the main ESV file of a language project must live at
editor/Main.esv (default) or
editor/main.esv. Other ESV files can be (transitively) imported from the main ESV file.
An ESV file starts with a module definition at the top of the file:
The module name is the filename of the ESV file without the exttension, and relative to the
editor/ directory. For example, the module
editor/mylang/Syntax.esv would have the following module name:
Module names can only contains the alphanumeric characters and dash, underscore, and period, and use the forward slash (
/) as the path separator.
Module names cannot be in parent directories, so
../Syntax is not allowed.
The imports section is an optional section immediately following the module definition. When specified it is given as:
For example, to import
imports Syntax Analysis
Imports are transitive.
At most one imports section is permitted. When specified, the
imports section cannot be empty.
The main body of an ESV file consists of any number of configuration sections. An example of a configuration section is:
language line comment: "//" block comment: "/*" "*/"
The configuration sections are hard-coded in the ESV language, but mostly use a consistent syntax for the keys and values.
The following configuration sections are currently defined:
The following sections have been deprecated:
The sources of ESV can be found at:
- metaborg/esv esv.lang: ESV language specification
Created: May 17, 2023