├── .DS_Store ├── .gitignore ├── .vscode └── launch.json ├── .vscodeignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── images └── icon.png ├── package.json └── snippets └── snippets.json /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefanjarina/vscode-eex-snippets/fa671d189a0da2b4d8ad3395136012835c3df2be/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.vsix 3 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that launches the extension inside a new window 2 | { 3 | "version": "0.1.0", 4 | "configurations": [ 5 | { 6 | "name": "Extension", 7 | "type": "extensionHost", 8 | "request": "launch", 9 | "runtimeExecutable": "${execPath}", 10 | "args": ["--extensionDevelopmentPath=${workspaceRoot}" ] 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | .gitignore 4 | vsc-extension-quickstart.md 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## [0.0.1] 4 | 5 | - Initial release 6 | 7 | ## [0.0.2] 8 | 9 | - Add icon and document snippets in README file 10 | 11 | ## [0.0.3] 12 | 13 | - Remove Installation section from README.md as there are no special installation steps required. 14 | - Release Notes in README now only point to this file to avoid managing the same on 2 places 15 | 16 | ## [0.0.4] 17 | 18 | - Updated to support both commonly used Elixir extensions 19 | - The new [ElixirLS: Elixir support and debugger](https://marketplace.visualstudio.com/items?itemName=JakeBecker.elixir-ls) 20 | - The old and no longer updated [vscode-elixir](https://marketplace.visualstudio.com/items?itemName=mjmcloug.vscode-elixir) 21 | 22 | ## [0.0.5] 23 | 24 | - Fix the exec_block from `<%- %>` to `<% %>` as it is in documentation 25 | - Add additional trigger `ee` for exec_block `<% %>` 26 | 27 | ## [0.0.6] 28 | 29 | - Add snippet `eex_link_block` with trigger `ltb` 30 | 31 | ## [0.0.7] 32 | 33 | - Merged [#5](https://github.com/stefanjarina/vscode-eex-snippets/pull/5) from @zolrath 34 | - Adds support for new compliant language identifiers `eex` and `html-eex` 35 | 36 | ## [0.0.8] 37 | 38 | - Merged [#7](https://github.com/stefanjarina/vscode-eex-snippets/pull/7) from @malloryerik 39 | - Add phoenix-heex and surface support 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Stefan jarina 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EEx snippets 2 | 3 | This extension contains code snippets for Elixir `.eex`, `.html.eex`, `.heex` and `.sface` files for [VS Code](https://code.visualstudio.com/) editor. 4 | 5 | **Enjoy!!!** 6 | 7 | ## Supported languages (file extensions) 8 | 9 | - `EEx` or `eex` (.eex) 10 | - `HTML (EEx)` or `html-eex` (.html.eex) 11 | - `HEEx` or `phoenix-heex` (.heex) 12 | - `surface` (.sface) 13 | 14 | ## Snippets 15 | 16 | Below is a list of all available snippets. 17 | 18 | ### Basic 19 | 20 | | Trigger | Content | 21 | | -----------------: | --------------------------------------------------------------------------------------------------- | 22 | | `e=` | render block `<%= %>` | 23 | | `ee`
or `e-` | exec block `<% %>` | 24 | | `e#` | comment `<%# %>` | 25 | | `end` | end tag `<% end %>` | 26 | | `lt` | link `<%= link "${1:text}", to: ${2:url} %>` | 27 | | `ltb` | link block
`<%= link to: ${1:url} do %>`
    `${2:text}`
`<% end %>"` | 28 | | `render` | render `<%= render "${1:partial}.html", ${2:local_var: @local} %>` | 29 | 30 | ### Control flow 31 | 32 | | Trigger | Content | 33 | | -------: | ------------------------------------ | 34 | | `for` | for `<%= for $1 <- $1 do %>` | 35 | | `if` | if `<%= if $1 do %>` | 36 | | `ife` | if else `<%= if $1 do %> <% else %>` | 37 | | `cond` | cond `<%= cond do %>` | 38 | | `unless` | unless `<%= unless $1 do %>` | 39 | 40 | ### Forms 41 | 42 | | Trigger | Content | 43 | | ------: | ------------------------------------------------------------------------------- | 44 | | `ff` | form_for `<%= form_for @${1:changeset}, ${2:url}, ${3:[]}, fn f -> %>` | 45 | | `et` | form error `<%= error_tag ${1:f}, :${2:field} %>` | 46 | | `la` | form label `<%= label ${1:f}, :${2:field}, "${3:Text}" %>` | 47 | | `ti` | form text input `<%= text_input ${1:f}, :${2:field} %>` | 48 | | `pi` | form password input `<%= password_input ${1:f}, :${2:field} %>` | 49 | | `subm` | form submit `<%= submit ${1:Text} %>` | 50 | | `submc` | form submit with class `<%= submit ${1:Text}, class: "${3:btn btn-primary}" %>` | 51 | 52 | ## Release Notes 53 | 54 | Please read the [CHANGELOG](CHANGELOG.md) to see what has changed in this extension over time. 55 | 56 | ## Known Issues 57 | 58 | Not really an issue but I wanted the `e=, e-, e#` snippets to be just a `=, -, #`, but they didn't trigger on these special characters so had to prepend them with `e` letter. 59 | 60 | ## Disclaimer 61 | 62 | Graciously borrowed some of the snippets from the [phoenix-elixir-snippets](https://atom.io/packages/phoenix-elixir-snippets) for Atom and refactored them to work with VS Code. 63 | 64 | ## Contribution 65 | 66 | ```sh 67 | git clone https://github.com/stefanjarina/vscode-eex-snippets 68 | ``` 69 | 70 | And copy the `vscode-eex-snippets` folder into the `/.vscode/extensions` folder. Restart Code. 71 | 72 | ## License 73 | 74 | [MIT](LICENSE.md) License 75 | 76 | Copyright (c) 2017 Stefan jarina 77 | -------------------------------------------------------------------------------- /images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefanjarina/vscode-eex-snippets/fa671d189a0da2b4d8ad3395136012835c3df2be/images/icon.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vscode-eex-snippets", 3 | "displayName": "EEx snippets", 4 | "description": "Elixir EEx and HTML (EEx) code snippets.", 5 | "version": "0.0.8", 6 | "publisher": "stefanjarina", 7 | "license": "MIT", 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/stefanjarina/vscode-eex-snippets.git" 11 | }, 12 | "engines": { 13 | "vscode": "^1.18.0" 14 | }, 15 | "categories": [ 16 | "Snippets" 17 | ], 18 | "icon": "images/icon.png", 19 | "contributes": { 20 | "snippets": [ 21 | { 22 | "language": "EEx", 23 | "path": "./snippets/snippets.json" 24 | }, 25 | { 26 | "language": "HTML (EEx)", 27 | "path": "./snippets/snippets.json" 28 | }, 29 | { 30 | "language": "Eex", 31 | "path": "./snippets/snippets.json" 32 | }, 33 | { 34 | "language": "HTML (Eex)", 35 | "path": "./snippets/snippets.json" 36 | }, 37 | { 38 | "language": "eex", 39 | "path": "./snippets/snippets.json" 40 | }, 41 | { 42 | "language": "html-eex", 43 | "path": "./snippets/snippets.json" 44 | }, 45 | { 46 | "language": "phoenix-heex", 47 | "path": "./snippets/snippets.json" 48 | }, 49 | { 50 | "language": "surface", 51 | "path": "./snippets/snippets.json" 52 | } 53 | ] 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /snippets/snippets.json: -------------------------------------------------------------------------------- 1 | { 2 | "eex_render_block": { 3 | "prefix": "e=", 4 | "body": ["<%= $1 %>"], 5 | "description": "<%= %> render block" 6 | }, 7 | "eex_exec_block": { 8 | "prefix": ["ee", "e-"], 9 | "body": ["<% $1 %>"], 10 | "description": "<% %> exec block" 11 | }, 12 | "eex_comment_block": { 13 | "prefix": "e#", 14 | "body": ["<%# $1 %>"], 15 | "description": "<%# %> comment block" 16 | }, 17 | "eex_end_tag": { 18 | "prefix": "end", 19 | "body": ["<% end %>$1"], 20 | "description": "<% end %> end tag" 21 | }, 22 | "for": { 23 | "prefix": "for", 24 | "body": [ 25 | "<%= for ${1:item} <- @$1s do %>", 26 | " $2", 27 | "<% end %>" 28 | ], 29 | "description": "eex for" 30 | }, 31 | "eex_if": { 32 | "prefix": "if", 33 | "body": [ 34 | "<%= if $1 do %>", 35 | " $2", 36 | "<% end %>" 37 | ], 38 | "description": "eex if" 39 | }, 40 | "eex_if_else": { 41 | "prefix": "ife", 42 | "body": [ 43 | "<%= if $1 do %>", 44 | " $2", 45 | "<% else %>", 46 | " $3", 47 | "<% end %>" 48 | ], 49 | "description": "eex if else" 50 | }, 51 | "eex_else": { 52 | "prefix": "else", 53 | "body": [ 54 | "<% else %>" 55 | ], 56 | "description": "eex else" 57 | }, 58 | "eex_cond": { 59 | "prefix": "cond", 60 | "body": [ 61 | "<%= cond do %>", 62 | " <% $1 -> %>", 63 | " $2", 64 | " <% true -> %>", 65 | " $3", 66 | "<% end %>" 67 | ], 68 | "description": "eex cond" 69 | }, 70 | "eex_unless": { 71 | "prefix": "unless", 72 | "body": [ 73 | "<%= unless $1 do %>", 74 | " $2", 75 | "<% end %>" 76 | ], 77 | "description": "eex unless" 78 | }, 79 | "eex_form_for": { 80 | "prefix": "ff", 81 | "body": [ 82 | "<%= form_for @${1:changeset}, ${2:url}, ${3:[]}, fn f -> %>", 83 | " $4", 84 | "<% end %>" 85 | ], 86 | "description": "eex form_for" 87 | }, 88 | "eex_error_tag": { 89 | "prefix": "et", 90 | "body": [ 91 | "<%= error_tag ${1:f}, :${2:field} %>" 92 | ], 93 | "description": "eex form error tag" 94 | }, 95 | "eex_text_input": { 96 | "prefix": "ti", 97 | "body": [ 98 | "<%= text_input ${1:f}, :${2:field} %>" 99 | ], 100 | "description": "eex form text input" 101 | }, 102 | "eex_label": { 103 | "prefix": "la", 104 | "body": [ 105 | "<%= label ${1:f}, :${2:field}, \"${3:Text}\" %>" 106 | ], 107 | "description": "eex form label" 108 | }, 109 | "eex_submit": { 110 | "prefix": "subm", 111 | "body": [ 112 | "<%= submit ${1:Text} %>" 113 | ], 114 | "description": "eex form submit" 115 | }, 116 | "eex_submit_c": { 117 | "prefix": "submc", 118 | "body": [ 119 | "<%= submit ${1:Text}, class: \"${3:btn btn-primary}\" %>" 120 | ], 121 | "description": "eex form submit with class" 122 | }, 123 | "eex_password_input": { 124 | "prefix": "pi", 125 | "body": [ 126 | "<%= password_input ${1:f}, :${2:field} %>" 127 | ], 128 | "description": "eex form password input" 129 | }, 130 | "eex_link": { 131 | "prefix": "lt", 132 | "body": [ 133 | "<%= link \"${1:text}\", to: ${2:url} %>" 134 | ], 135 | "description": "eex link" 136 | }, 137 | "eex_link_block": { 138 | "prefix": "ltb", 139 | "body": [ 140 | "<%= link to: ${1:url} do %>", 141 | "\t${2:text}", 142 | "<% end %>" 143 | ], 144 | "description": "eex link block" 145 | }, 146 | "eex_render": { 147 | "prefix": "render", 148 | "body": [ 149 | "<%= render \"${1:partial}.html\", ${2:local_var: @local} %>" 150 | ], 151 | "description": "eex render" 152 | } 153 | } 154 | --------------------------------------------------------------------------------