Skip to content

Commit

Permalink
add simple highlight for @let
Browse files Browse the repository at this point in the history
  • Loading branch information
princemaple authored Aug 2, 2024
1 parent 5ab46f7 commit 0b4c149
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 10 additions & 3 deletions NgxHTML.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ version: 2
extends: Packages/HTML/HTML.sublime-syntax

variables:
angular_blocks: (?<=\@)\b(?xi:for | if | else | else if | switch | case | empty | placeholder | defer | default | error | loading)\b
angular_blocks: (?<=\@)\b(?xi:for | if | else | else if | switch | case | empty | placeholder | defer | default | error | loading | let)\b

contexts:
main:
- meta_prepend: true
- include: interpolation
- include: angular-blocks
- include: ng-control-flow

interpolation:
- match: '{{'
Expand Down Expand Up @@ -88,12 +88,19 @@ contexts:
- tag-event-attribute-assignment


angular-blocks:
ng-control-flow:
- match: '(@){{angular_blocks}}'
scope: keyword.control.control-flow.html
captures:
1: punctuation.definition.keyword.html
push:
- match: '='
scope: punctuation.section.let.begin.ngx.html
push:
- meta_scope: meta.let.ngx.html
- match: ';'
scope: punctuation.section.let.end.ngx.html
pop: 2
- match: \{
scope: punctuation.section.block.begin.html
push:
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ Highlighting the JS part as JS. So,

Now it supports Angular control flow.

```
@let myVar = myObservable | async;
```

```
@for (item of items) {
<a [href]="item.link">{{item.title}}</a>
Expand Down

0 comments on commit 0b4c149

Please sign in to comment.