Highlighting for any DSL
The colors go by the shape of a file, not by the names in it: a call with a block is a keyword, any other call a function.
Checks against a schema
A JSON file says which keywords your DSL has and where they go. Anything else is an error, right in the editor.
Completion
The editor offers the keywords that fit at the cursor, with their descriptions, from the same schema.
Outline and folding
The calls and their blocks, as an outline and as breadcrumbs. Blocks, argument lists and comments fold.
The same parser in your tool
The libraries for Java and npm read a script exactly as the editor does: calls, arguments and blocks.
Runs everywhere
One server in Kotlin Multiplatform, as a native executable, a jar and a Node.js script. Nothing else to install.
A schema makes it your language
Put services.json in a .dsl folder, or let your tool bring it through its plugin of Gradle or Maven or in its npm package. Every services.dsl is then checked against it.
{
"root": ["service"],
"keywords": {
"service": { "block": ["replicas", "uses", "routes"] },
"replicas": { "description": "How many run." },
"uses": {},
"routes": { "block": ["get", "post"] },
"get": {},
"post": {}
}
}
service("orders") {
// Unknown keyword 'replica'.
// Allowed here: replicas, uses, routes
replica(3)
// 'post' is not allowed in 'service'.
post("/orders")
}
In your editor
The extension for VS Code and the plugin for the IDEs of JetBrains come with the server. Every other editor starts it with one command.