Announcing Langium 0.3


After months of work, we are finally able to announce the release of Langium 0.3. It features extensive changes to our grammar infrastructure, so let’s dive right in:
Multi-language support
After adding workspace support in Langium 0.2, we now also support working with multiple languages within a single language server. Each language gets its own dedicated grammar and file extension. This change comes hand in hand with the added support to import other grammars, which allows you to cross-reference elements from other languages.
Due to the extend of this change, we had to break a large amount of existing APIs. If you are wondering how to migrate from Langium 0.2, consult the changelog or ask us directly.
Explicit type declarations
Until now, types in Langium have been inferred from the grammar rules. While this is a very powerful feature for small DSLs, it can be a source of breaking changes for mature language projects since every grammar change potentially also changes the generated types. To resolve this problem we now support explicit type declarations. Using a TypeScript like syntax, types can now be declared directly in the grammar. These types will be directly added to the generated meta-model:
interface Entity {
name: string
visibility?: "public" | "private" | "protected" // '?' indicates an optional property
superType?: @Entity // '@' indicates a reference type
features: Feature[]
}
type Symbol = Entity | PackageDeclaration | DataType | Feature
These type declarations will help you to avoid accidentally introducing breaking changes. They can also be mixed with existing, inferred types.
This feature introduces a breaking change in the grammar language:
Before, parser rules used the returns
directive to infer a new type.
We now differentiate between two cases and use an infers
keyword when a new type has to be inferred, and a returns
keyword when a declared type is referenced.
New quick fixes and validations will help you navigate these changes.
Other noteable changes
- We finally have a website to host guides, tutorials and documentation for Langium.
- The new langium-sprotty package introduces Eclipse-Sprotty support. You can see it in action here.
- Importing other grammar files by simply using
import './path/to/grammar'
. - Support rule guard conditions.
If you’re interested in everything that happened during the last months, you can take a look at our changelog.
What’s next?
Now that we’ve performed a bulk of grammar changes, we aim to keep future releases a bit smaller. Expect to see more regular releases from now on!
- More language server features, such as formatting and improved completion
- Better utilities for testing your languages
Stay tuned for more updates on Langium by watching the repository over at GitHub. Also, if you’re interested in contributing to Langium, consider joining TypeFox. We’re hiring!
About the Authors

Mark Sujew
Mark is the driving force behind a lot of TypeFox’s open-source engagement. He leads the development of the Eclipse Langium and Theia IDE projects. Away from his day job, he enjoys bartending and music, is an avid Dungeons & Dragons player, and works as a computer science lecturer at a Hamburg University.