GJS BNF Language for VS Code SupportFull-featured VS Code extension for Backus-Naur Form (BNF) grammar files ( FeaturesSyntax HighlightingDistinct colours for every element of a BNF grammar:
Includes a dedicated BNF Dark colour theme. Real-time ValidationErrors and warnings appear inline as you type and in the Problems panel.
Validation fires on open, on type (debounced, configurable), and on save. FormattingTrigger with
IntelliSense
Commands
Supported BNF Syntax
Snippets
ConfigurationAll settings are under Formatter (
|
| Setting | Default | Description |
|---|---|---|
maxLineWidth |
80 |
Max line width before wrapping alternatives |
alignDefinitions |
true |
Align all ::= to the same column |
indentAlternatives |
true |
Wrap alternatives with indented \| |
quoteStyle |
"double" |
"double" / "single" / "preserve" |
Validation (gjsBnf.validation.*)
| Setting | Default | Description |
|---|---|---|
enabled |
true |
Enable/disable all validation |
onType |
true |
Validate while typing |
onSave |
true |
Validate on save |
debounceMs |
400 |
Debounce delay in ms |
warnUnusedRules |
true |
Warn on unused rules |
warnEmptyTerminals |
true |
Warn on empty terminals |
Hover (gjsBnf.hover.*)
| Setting | Default | Description |
|---|---|---|
enabled |
true |
Enable hover tooltips |
showRuleBody |
true |
Include rule body in tooltip |
Graph (gjsBnf.graph.*)
| Setting | Default | Description |
|---|---|---|
direction |
"LR" |
Graph direction: LR, TB, RL, BT |
showTerminals |
false |
Include terminal nodes in graph |
Installation
From VSIX
code --install-extension gjs-bnf-extension-1.0.0.vsix
Or via VS Code: Extensions → ··· → Install from VSIX
From source
git clone https://github.com/gjs/gjs-bnf-extension
cd gjs-bnf-extension
npm install
npm run compile
npm run package # produces gjs-bnf-extension-1.0.0.vsix
Development
npm run watch # compile in watch mode
npm run test:unit # run unit tests
npm run lint # ESLint
npm run format:fix # Prettier
See CHANGELOG.md for version history.
License
MIT