How to convert a TextMate Grammar (XML flavor) to either YAML or JSON flavor
Asked Answered
I

1

9

Textmate grammar (.tmLanguage files) are sometimes expressed in XML format.

I would like to convert to a more readable format (i.e. JSON or YAML) to integrate in a VS Code Syntax Highlighting Extension.

To clarify what I mean, here are a few examples:

I could write a script in Python to do that but it would save me some time if such converter already exists.

Thanks

Incline answered 18/4, 2020 at 1:43 Comment(0)
V
13

The TextMate Languages extension has some commands built-in for this. Screenshot from the readme:

Vallation answered 18/4, 2020 at 8:14 Comment(4)
Awesome! I wrote a python script anyway, not very complex data structure.Incline
Press CTRL+SHIFT+P and type Convert to see this view. It works really fast for XML.Coercive
This extension is now unmaintained, but this fork is up-to-date: marketplace.visualstudio.com/items?itemName=pedro-w.tmlanguageFiling
Isn't a python library one can use to not depend on this vscode extension?Shurwood

© 2022 - 2024 — McMap. All rights reserved.