Skip to content

Latest commit

 

History

History
35 lines (28 loc) · 1.66 KB

README.md

File metadata and controls

35 lines (28 loc) · 1.66 KB

Work with language syntax files

According Visual Studio Code Syntax Highlight Guide:

As a grammar grows more complex, it can become difficult to understand and maintain it as json. If you find yourself writing complex regular expressions or needing to add comments to explain aspects of the grammar, consider using yaml to define your grammar instead.

Yaml grammars have the exact same structure as a json based grammar but allow you to use yaml's more concise syntax, along with features such as multi-line strings and comments.

VS Code can only load json (or plist) grammars, so yaml based grammars must be converted to json (or plist).

To work easier with TextMate YAML language files install VSCode extension TextMate Languages from Ben Hockley.

  • Use commands "Convert to YAML-tmLanguage file" and "Convert to tmLanguage file" provided by extension TextMate Languages.

  • Alternatively download plist-yaml-plist from Github and use below commands: (On Windows use WSL)

    /path/to/plist_yaml.py erlang.tmLanguage erlang.yaml-tmLanguage
    # Edit YAML file here ... then if you are ready convert back to PLIST
    /path/to/yaml_plist.py erlang.yaml-tmLanguage erlang.tmLanguage
    

References

  1. Visual Studio Code Syntax Highlight Guide
  2. TextMate Language Grammars
  3. Writing a TextMate Grammar: Some Lessons Learned