langium

A language engineering tool for the Language Server Protocol

MIT 77 个版本
安装
npm install langium
yarn add langium
pnpm add langium
bun add langium
README

Langium

Langium is a language engineering tool with built-in support for the Language Server Protocol. It has a simple and direct integration with the VS Code extension API.

More information: 🌍 https://langium.org

Getting Started

Langium offers a Yeoman generator to create a new language extension for VS Code. The only prerequisite for the following terminal commands is NodeJS version 16 or higher.

  1. Install Yeoman and the Langium extension generator.
npm install -g yo generator-langium
  1. Run the generator and answer a few questions.
yo langium
  1. Open the new folder in VS Code (replace hello-world with the extension name you chose).
code hello-world
  1. Press F5 to launch the extension in a new Extension Development Host window.

  2. Open a folder, create a file with your chosen file name extension (.hello is the default), and see that validation and completion (ctrl+space) works:

Follow the instructions in langium-quickstart.md (in your extension folder) and the documentation on the website to go further.

How Does it Work?

The core of Langium is a grammar declaration language in which you describe multiple aspects of your language:

  • Tokens (keywords and terminal rules)
  • Syntax (parser rules)
  • Abstract syntax tree (AST)

Please follow the Langium documentation to learn how to use this language.

Langium features a command line interface (langium-cli) that reads a grammar declaration and generates TypeScript type declarations for the AST and more.

Integration with the Language Server Protocol (LSP) is done with vscode-languageserver. You have full access to the LSP API in Langium, so you can register additional message handlers or extend the protocol in a breeze.

The main code of Langium consists of a set of services that are connected via dependency injection (DI). You can override the default functionality and add your own service classes by specifying a DI module.

Examples

The source repository of Langium includes examples that demonstrate different use cases.

版本列表
4.3.1 2026-07-02
4.3.0 2026-06-15
4.3.0-next.a52b426 2026-06-08
4.2.4 2026-05-11
4.2.3 2026-05-01
4.2.2 2026-04-07
4.2.2-next.d9c47299 2026-04-30
4.2.1 2026-02-10
4.2.0 2026-01-27
4.1.3 2025-12-19
4.1.2 2025-11-26
4.1.1 2025-11-20
4.1.0 2025-09-19
4.0.3 2025-09-16
4.0.2 2025-09-16
4.0.1 2025-09-10
4.0.0 2025-07-31
3.5.0 2025-04-17
3.5.0-next.936a9d7 2025-07-03
3.5.0-next.91328d6 2025-07-22
3.4.0 2025-02-26
3.4.0-next.89c0a9d 2025-03-28
3.4.0-next.325db9f 2024-12-11
3.4.0-next.325db9e 2024-12-11
3.4.0-next.1409e5d 2024-12-11
3.4.0-next.10c0eb7 2025-03-04
3.3.1 2025-01-23
3.3.0 2024-11-18
3.2.1 2024-11-05
3.2.0 2024-09-06
3.2.0-next.2191297 2024-07-01
3.2.0-next.bb9f2d3 2024-07-02
3.2.0-next.9134e27 2024-07-02
3.2.0-next.5063a2b 2024-08-29
3.1.3 2024-08-07
3.1.2 2024-07-04
3.1.1 2024-06-24
3.1.0 2024-06-20
3.1.0-next.cbc5db3 2024-06-11
3.1.0-next.c8e01a2 2024-06-11
3.1.0-next.4bbc180 2024-06-18
3.0.0 2024-02-29
3.0.0-next.e78aeba 2024-02-14
3.0.0-next.cc1a49c 2024-02-27
3.0.0-next.79e4301 2023-12-12
2.1.3 2023-11-21
2.1.2 2023-11-08
2.1.1 2023-11-06
2.1.0 2023-11-02
2.0.2 2023-09-05
2.0.1 2023-08-22
2.0.0 2023-08-17
2.0.0-next.a57102f 2023-08-08
2.0.0-next.239179f 2023-07-25
1.3.1 2023-09-05
1.3.0 2023-08-17
1.2.1 2023-06-22
1.2.0 2023-05-02
1.1.0 2023-02-15
1.0.1 2022-12-23
1.0.0 2022-12-16
0.6.0-next.62c127c 2022-11-08
0.5.0 2022-10-05
0.5.0-next.f2b3802 2022-06-29
0.5.0-next.f150dbd 2022-09-02
0.5.0-next.52ab085 2022-09-16
0.4.0 2022-06-09
0.3.0 2022-03-17
0.3.0-next.ee4fc4e 2022-03-15
0.3.0-next.5e9d27d 2021-12-16
0.2.0 2021-11-03
0.2.0-next.1f60202 2021-10-18
0.1.0 2021-06-24
0.1.0-next.b687a8a 2021-06-24
0.1.0-next.6f45aec 2021-06-24
0.1.0-next.0e84185 2021-06-24
0.1.0-next.00ebfd9 2021-06-16