Convert YAML TMLanguage syntax with variables to JSON format.
npm install com.hydroperfox.tmlanguage.yaml2json{{variableName}} syntax.
sh
npm i -g com.hydroperfox.tmlanguage.yaml2json
`
Write a file mylanguage.tmLanguage.yaml:
`yaml
tmLanguage
---
$schema: https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json
name: MyLanguageName
scopeName: source.mylang
variables:
someVar: 'xxx'
patterns:
- include: '#foo'
repository:
foo:
patterns: []
`
Then run:
`
tmlangyaml2json mylanguage.tmLanguage.yaml mylanguage.tmLanguage.json
`
The output looks like follows:
`json
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "MyLanguageName",
"patterns": [
{
"include": "#foo"
}
],
"repository": {
"foo": {
"patterns": []
}
},
"scopeName": "source.mylang"
}
``