-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add html highlight to angular component template
#818
Comments
They have a branch supporting it: https://github.com/billti/TypeScript-TmLanguage/blob/ngml/TypeScript.YAML-tmLanguage#L507 (reference: microsoft/TypeScript#6508). |
Is there anyway to get html highlighting in between template: |
Excuse me I can't figure out how to add the html syntax highlighted in ts files when you write templates in the middle of these --> `` Is there any tutorial for add this feature? |
So does that men we get syntax highlight in template strings using Atom now ? as described here: ? |
@basarat Was this ever added somehow to Atom? Would love template highlighting! 👍 |
@blakeembrey I started to integrate the grammar you have mentioned: https://github.com/billti/TypeScript-TmLanguage/blob/ngml/TypeScript.YAML-tmLanguage#L507 ProblemUnfortunately the linked grammar does not work if there are any html attributes in the template. QuestionDo you know of a updated grammar source we could use? My approachI simply downloaded the language within scripts/grammar.js and merged the ng-grammar into the official grammar provided by Microsoft. |
@GregOnNet Maybe you can mark it as the built-in HTML grammar? |
Yes, I will try. Kinds |
Applies for @component decorator provided by Angular 2 TypeStrong#818
This is done by running `npm run build` TypeStrong#818
Can we play around & test this implementation if we update Atom typescript @GregOnNet ? Wow nice job guys 👍 |
@MarkPieszak Thanks, I created a pull-request and hope it will be merged soon: #948 If you want to test this feature you only have the possibility to clone atom-typescript, checkout my branch and link it manually into Atom. Kinds |
* Adds custom grammar enabling html syntax highlighting Applies for @component decorator provided by Angular 2 #818 * Applies grammar for html syntax highlighting to ts.cson and tsx.cson This is done by running `npm run build` #818 * Allows backticks inside html-templates without breaking syntax-highlighting * Updates TypeScript grammar based on grammar.js Done by running npm run build
Released with https://github.com/TypeStrong/atom-typescript/releases/tag/v8.10.0 Thanks @GregOnNet ! 🌹 |
This only works for properties called 'template' inside of objects. but:
|
Now that atom-typescript uses atom's built-in language-typescript grammar this feature seems to have gone missing. Would it be possible to add a grammar that imports atom's language-typescript and adds the html rule? This would be useful for maintaining old angular projects. |
We don't currently have the resources to maintain the grammar, sorry. And upstream isn't too keen on including this either. It should be possible to write a grammar injection though. If you want to try your hand at that, you can take a look how Atom's TODO injection grammar does that: https://github.com/atom/language-todo |
So I went ahead and got a basic grammar injection for this that checks both ts and js files for inline template and styles where it can then use the default html/css grammar rules. Feel free to use it or open PRs to make it better. I didn't put that much time into it so I'm sure it could be improved: https://github.com/colingm/language-angular-inline |
This can be added as demonstrated here : #798
That work was dropped with
v8.0.0
when we moved to a Microsoft maintained text mate grammar. We have a script https://github.com/TypeStrong/atom-typescript/blob/5dfdd68497a0b3b3a7d6bc3575c223400ef29f0b/scripts/grammar.js (run usingnpm build
in our project root) that contains any custom rules.The custom template rules need to be added to
grammar.js
🌹The text was updated successfully, but these errors were encountered: