|
1 | 1 | # ElixirSyntax |
2 | 2 |
|
3 | | -ElixirSyntax was initially based on the [Elixir.tmbundle package](https://github.com/elixir-editors/elixir-tmbundle) but has been rewritten since, providing more accurate syntax matching as well as better syntax highlighting. Works with `goto definition`! |
4 | | - |
5 | | -## Changes |
6 | | - |
7 | | -See [CHANGELOG.md](./CHANGELOG.md) for the list of releases and noteworthy changes. |
| 3 | +ElixirSyntax was initially based on the [Elixir.tmbundle package](https://github.com/elixir-editors/elixir-tmbundle) but has been rewritten since, providing more accurate syntax matching as well as better syntax highlighting. |
8 | 4 |
|
9 | 5 | ## Features |
10 | 6 |
|
11 | | -Some of the provided features are not immediately evident. Among them are: |
| 7 | +* Working `Goto Definition` functionality |
| 8 | +* LiveView template highlighting: `~L"..."`\ |
| 9 | + (Note: will be changed to the new HEEx syntax eventually.) |
| 10 | +* Full PCRE syntax highlighting: <img src="images/elixir_regex_example.svg" width="270" align="top"> |
| 11 | +* Type highlighting: <img src="images/elixir_type_example.svg" width="620" align="top"> |
| 12 | + |
| 13 | +Some of the other provided features are not immediately evident. Among them are: |
12 | 14 |
|
13 | 15 | ### The `fragment` and `sql` functions |
14 | 16 |
|
15 | 17 | SQL syntax is highlighted inside Ecto's `fragment` macro. |
16 | 18 |
|
17 | | -<blockquote><span class="mod">Post</span> |
18 | | -<span class="kw">|></span> <span class="fnc">where</span>([post], <span class="fnc">fragment</span>(<span class="str_dlm">"</span><span class="prpl">?</span>.full_text <span class="kw"><@</span> <span class="fnc">to_tsquery</span>(<span class="prpl">?</span>)<span class="str_dlm">"</span>, post, terms)) |
| 19 | +<blockquote> |
| 20 | +<img src="images/elixir_fragment_example.svg" width="100%"> |
19 | 21 | </blockquote> |
20 | 22 |
|
21 | 23 | Add an `sql` macro/function to your project to enjoy SQL highlighting anywhere it's used. |
22 | 24 |
|
23 | | -<blockquote><span class="blu_i">defmacro</span> <span class="entity">sql</span>(<span class="param">sql</span>), <span class="akw">do</span><span class="colon">:</span> sql |
24 | | -<span class="fnc">sql</span>(<span class="str_dlm">"</span><span class="kw">SELECT</span> <span class="param">*</span> <span class="kw">FROM</span> posts <span class="kw">ORDER</span> <span class="kw">BY</span> title <span class="kw">GROUP</span> <span class="kw">BY</span> user_id<span class="str_dlm">"</span>) |
| 25 | +<blockquote> |
| 26 | +<img src="images/elixir_sql_example.svg" width="100%"> |
25 | 27 | </blockquote> |
26 | 28 |
|
27 | 29 | ### The JSON `~j` and `~J` sigils |
28 | 30 |
|
29 | | -Embed JSON strings in your Elixir code. (Notice the interpolated Elixir code is rendered properly.) |
| 31 | +Embed JSON strings in your Elixir code. Notice the interpolated Elixir code is colored correctly. |
30 | 32 |
|
31 | | -<blockquote><span class="blu_i">~j</span><span class="str_dlm">"""</span> |
32 | | -{ |
33 | | - <span class="str_dlm">"</span><span class="str">key</span><span class="str_dlm">"</span>: <span class="str_dlm">"</span><span class="intp_dlm">#{</span><span class="intp_bg">value</span><span class="intp_dlm">}</span><span class="str_dlm">"</span>, |
34 | | - <span class="str_dlm">"</span><span class="intp_dlm">#{</span><span class="intp_bg">key</span><span class="intp_dlm">}</span><span class="str_dlm">"</span>: <span class="str_dlm">"</span><span class="str">value</span><span class="str_dlm">"</span> |
35 | | -} |
36 | | -<span class="str_dlm">"""</span> |
| 33 | +<blockquote> |
| 34 | +<img src="images/elixir_json_example.svg" width="100%"> |
37 | 35 | </blockquote> |
38 | 36 |
|
39 | 37 | ### The YAML `~y` and `~Y` sigils |
40 | 38 |
|
41 | | -<blockquote><span class="blu_i">~Y</span><span class="str_dlm">"""</span> |
42 | | -<span class="kw">user</span>: |
43 | | - <span class="kw">name</span>: <span class="str">YAML</span> |
44 | | - <span class="kw">born</span>: <span class="prpl">2001</span><span class="prpl">-</span><span class="prpl">05</span><span class="prpl">-</span><span class="prpl">11</span> |
45 | | -<span class="str_dlm">"""</span> |
| 39 | +<blockquote> |
| 40 | +<img src="images/elixir_yaml_example.svg" width="100%"> |
46 | 41 | </blockquote> |
47 | 42 |
|
48 | | -### Etc. |
| 43 | +## Changes |
49 | 44 |
|
50 | | -Also supported are LiveView (`~L"..."`) and the full PCRE syntax (`~r"..."`). |
| 45 | +See [CHANGELOG.md](./CHANGELOG.md) for the list of releases and noteworthy changes. |
51 | 46 |
|
52 | 47 | ## Contributors/Maintainers |
53 | 48 |
|
|
0 commit comments