Skip to content
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

Angular2 Decorator Template Highlighting #798

Merged
merged 2 commits into from
Jan 2, 2016
Merged

Conversation

jbarket
Copy link

@jbarket jbarket commented Dec 30, 2015

Added simple support for Angular2 inline template highlighting. In short, if we find something that looks like this:

@component({
template: <some><html><here></here></html></some>
})

We activate text.html.basic highlighting on the contents of the multiline string.

It's possible that we could look specifically for @component, but right now, we're piggybacking off of #decorator to prevent weirdness/code duplication.

To make this work, I had to remove the $base include from #decorator. If people begin passing anonymous functions and so on to decorators, this will need revisiting. But right now, we're talking about booleans and objects, so I don't know that it really needs $base. If it does, probably better to just catch @Component->template on its own.

Jonathan Barket added 2 commits December 29, 2015 23:13
Added simple support for Angular2 inline template highlighting. In short, if we find something that looks like this:

@component({
  template: `
    <some><html><here></here></html></some>
  `
})

We activate text.html.basic highlighting on the contents of the multiline string.

It's possible that we could look specifically for @component, but right now, we're piggybacking off of #decorator to prevent weirdness/code duplication.

To make this work, I had to remove the $base include from #decorator. If people begin passing anonymous functions and so on to decorators, this will need revisiting. But right now, we're talking about booleans and objects, so I don't know that it really needs $base. If it does, probably better to just catch @Component->template on its own.
Removed placeholder styles that were helping me track my selector during testing. 'template' should be formatted like the rest of the decorator attributes.
@basarat
Copy link
Member

basarat commented Jan 2, 2016

Thanks. Work with #675 should preserve this 🌹

basarat added a commit that referenced this pull request Jan 2, 2016
Angular2 Decorator Template Highlighting
@basarat basarat merged commit c617bf4 into TypeStrong:master Jan 2, 2016
@basarat
Copy link
Member

basarat commented Jan 3, 2016

@pablodenadai
Copy link

Thanks guys! I was looking forward to this feature. 👏

@basarat
Copy link
Member

basarat commented Jan 12, 2016

Note that we are about to get automated upstream grammar : #813 That will lose this work. A PR modifying grammar.js automation script to support this would be appreciated once that is merged 🌹

@alindsay55661
Copy link

So, how do I active this? I am using version 8.1.0 and syntax highlighting isn't available for template strings.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants