|
1 | 1 | %YAML 1.2 |
2 | 2 | --- |
3 | | -version: 2 |
4 | 3 | # http://www.sublimetext.com/docs/3/syntax.html |
5 | 4 | name: Elixir |
6 | 5 | scope: source.elixir |
7 | | -file_extensions: [ex, exs] |
| 6 | +file_extensions: [ex, exs, ex.eex, exs.eex] |
8 | 7 | first_line_match: ^#!\s*/.*\b(?:elixirc?|iex) |
9 | 8 | authors: |
10 | 9 | # Contributed several times and later on finished a complete rewrite with lots of new features. |
@@ -64,6 +63,8 @@ contexts: |
64 | 63 | prototype: |
65 | 64 | # NB: rules in the prototype context will always match before any other. |
66 | 65 | - include: merge_conflict # Merge conflict markers can occur anywhere. |
| 66 | + - include: eex_tag |
| 67 | + - include: eex_end_tag |
67 | 68 |
|
68 | 69 | core_syntax: |
69 | 70 | # The rules are approximately ordered by their likeliness of occurrence |
@@ -112,7 +113,27 @@ contexts: |
112 | 113 | 6: comment.line.incoming.git.conflict |
113 | 114 | pop: true |
114 | 115 |
|
115 | | - ## Functions |
| 116 | + # Use prototype as a workaround to the "context sanity limit" error. |
| 117 | + # An issue that remains is that "<% ... %>" embeds are not independent |
| 118 | + # of the surroundings. |
| 119 | + eex_tag: |
| 120 | + - match: (<)(%(?>%=?|[=/|]?)) |
| 121 | + scope: source.elixir.eex |
| 122 | + captures: |
| 123 | + 1: punctuation.section.embedded.begin.ex.eex |
| 124 | + 2: entity.name.tag.ex.eex |
| 125 | + # NB: causes "context sanity limit" error. |
| 126 | + # push: core_syntax |
| 127 | + # with_prototype: |
| 128 | + # - match: (?=%>|<%) |
| 129 | + # pop: true |
| 130 | + |
| 131 | + eex_end_tag: |
| 132 | + - match: \s*(%)(>) |
| 133 | + scope: source.elixir.eex |
| 134 | + captures: |
| 135 | + 1: entity.name.tag.ex.eex |
| 136 | + 2: punctuation.section.embedded.end.ex.eex |
116 | 137 |
|
117 | 138 | fn_block: |
118 | 139 | - match: fn{{no_id_key_suffix}} |
|
0 commit comments