This example demonstrates how to register and serve multiple related languages inside one Pegium workspace.
It is the best starting point when your real project spans several grammars or file types that should still share one document and indexing model.
- a parser for
.reqfiles (requirements-lang) - a parser for
.tstfiles (tests-lang) - one shared workspace and one shared stdio LSP server
- cross-file and cross-language references
- service registration for multiple language ids
- several file types belong to one logical workspace
- references cross file or language boundaries
- you need a realistic multi-language service setup
- you want a concrete example for
registerServices(...)
From the repository root:
cmake -S . -B build
cmake --build build./build/examples/requirements/pegium-example-requirements-cli \
generate examples/requirements/example/requirements.req./build/examples/requirements/pegium-example-requirements-lspcmake -S . -B build
cmake --build buildcd examples/requirements
npm install
npm run compile- Open the repository root in VS Code.
- Go to
Run and Debug. - Start
Run Requirements ExtensionwithF5.
The launch configuration lives in the repository root
.vscode/launch.json and opens an Extension Development Host on
examples/requirements/example.
If the server binary is not found automatically, set either:
- the
pegium.requirements.serverPathsetting - the
PEGIUM_REQUIREMENTS_SERVERenvironment variable