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

Support to decorators in TypeScript #2819

Closed
lacolaco opened this issue Mar 21, 2021 · 2 comments · Fixed by #2820
Closed

Support to decorators in TypeScript #2819

lacolaco opened this issue Mar 21, 2021 · 2 comments · Fixed by #2820

Comments

@lacolaco
Copy link

lacolaco commented Mar 21, 2021

Motivation
I'd like to highlight my code relating Angular. Angular uses @Decorators often like below:

@Component({
  selector: 'my-app',
  template: `<div>Hello World!</div>`
})
export class AppComponent {}

A decorator is technically a function, but I want to separate its color from normal functions.

Currently, decorators are tokenized as function in language-typescript

image

Description

Adding .meta-like class to decorator name token.

@lacolaco
Copy link
Author

In addition, an object in the decorator is not tokenized correctly. As the below image, template and changeDetection are property names but not tokenized.

image

@RunDevelopment
Copy link
Member

With #2820, decorators will have a dedicated .decorator class.

an object in the decorator is not tokenized correctly

The syntax is too similar to type annotations. We will not able to distinguish between the two correctly. Sorry, but that isn't possible to implement with Prism.

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

Successfully merging a pull request may close this issue.

2 participants