atom-language-rust icon indicating copy to clipboard operation
atom-language-rust copied to clipboard

Turn TextMate grammar to json

Open mickaelistria opened this issue 5 years ago • 4 comments

Several IDEs like VSCode or Eclipse IDE are reusing (or planning to reuse) the TextMate grammar defined in rust.cson. However, it seems like those cannot parse .cson files, so they translate it to .json: https://github.com/Microsoft/vscode/blob/8fdf170a0850c1cc027382f31650aaf300d3ae2a/extensions/rust/syntaxes/rust.tmLanguage.json . Would it be possible to make the grammar in this repo directly a .json file? Would there be anything lost if doing so? Moving to .json has several benefits like easier reusability in other tools, but also as .json has more and better edition support across various editors/IDEs which make it easier to maintain than .cson in general. If this is acceptable, then it seems mostly a matter of just pulling the VSCode translation and cleaning the info messages.

cc @aeschli @Boereck

mickaelistria avatar Aug 27 '18 08:08 mickaelistria

I agree that it should be as easy to use as possible and that cson is an unusual format. Initially, this package was used for Atom only, but now it turned out to be useful for other applications as well, I have no objections to make it more portable by using json instead of cson.

As far as I know, Atom doesn't care if you use cson or json (I'm no Atom expert, so maybe somebody else can confirm this). However, I'm not sure how other packages depend on these files (npm lists marky-markdown and hl as dependants), so this change should probably introduce a new minor version then.

zargony avatar Aug 30 '18 09:08 zargony

I could make the PR for it, but I think in order to be cleaner in term of IP, it'd better be @aeschli providing the PR as he has the copyright for the "translation" effort.

mickaelistria avatar Aug 30 '18 09:08 mickaelistria

Our converter removes some properties and adds some information. So don't use what's in VSCode as starting point. Better take the original rust.cson and use the cson-parser node module to convert from cson to JSON.

aeschli avatar Aug 30 '18 13:08 aeschli

Is there any progress here?

jens1o avatar Oct 03 '18 15:10 jens1o