gandm / language-babel

ES2017, flow, React JSX and GraphQL grammar and transpilation for ATOM
https://atom.io/packages/language-babel
MIT License
476 stars 83 forks source link

Question: Add TypeScript to supported file extensions? #357

Closed mattmischuk closed 7 years ago

mattmischuk commented 7 years ago

I'm using language-babel for syntax highlighting for TypeScript. There isn't a good package that I've found to date. I usually just manually add the extension in the grammar file locally. But I was wondering if it would be worth while to just create a pull-request. This may conflict with other packages so I thought I would pose this as a question first. Thoughts?

gandm commented 7 years ago

I'm a bit reluctant as this grammar isn't Typescript compatible. You could us the config.cson to force .ts files to use my grammar - https://discuss.atom.io/t/how-do-i-make-atom-recognize-a-file-with-extension-x-as-language-y/26539

I guess you've tried the https://github.com/TypeStrong/atom-typescript package? It syncs with Microsoft's vscode grammar so it should be up to date.

mattmischuk commented 7 years ago

I have, the syntax highlighting is not as good. Also it adds a bunch of bloat and unnecessary features. I guess all I really want is a plain grammar and syntax package. Which your package works wonders for... I'll try out the config.cson solution for now. I might just fork this repo and make a dedicated language-typescript package.

mattmischuk commented 7 years ago

Does this change anything?

https://github.com/babel/babylon/pull/523#issuecomment-311720960

gandm commented 7 years ago

@mattmischuk Not sure. It would mean augmenting the grammar to handle specific typescript features and whilst I imagine this wouldn't be a problem I may be wrong. A lot of elements that are common are scoped as flowtype and I don't want to change these nor do I want to add a new scope.

The parser seems interesting but I'm not sure who it's aimed at. I'd imagine most TypeScripters would still use tsc with Babel as a backend tool. I'd be interested to see what other TypeScript users think.

gandm commented 7 years ago

I don't see much traction for this at the moment. The Atom team has ported the Microsoft typescript grammar recently and are also working on other initiatives that are better suited to a TypeScript workflow. See https://github.com/atom/language-typescript and https://atom.io/packages/ide-typescript

mattmischuk commented 7 years ago

Good call, thanks for reviewing this again :)

trusktr commented 6 years ago

I'm using TypeScript, but I want syntax highlighting inside of template strings. It'd be awesome to add TypeScript so that it can have this feature.