VSCode Custom User Snippets For EEx Templates Not Working

settings.json

"files.associations": {
    ".eex": "HTML (EEx)",
    ".html.eex": "HTML (EEx)",
    "*.eex": "HTML (EEx)",
    "*.html.eex": "HTML (EEx)"
  }

HTML (EEx).json

{
  "Text Link": {
    "prefix": "tl",
    "body": [
      "<%= link \"$1\", to: Routes.$2_path(@conn, :$3)%4 %>$0",
    ],
    "description": "Text Link"
  }
}

Extensions

  • ElixirLS Fork

I open a *.html.eex template file, VSCode registers it as a HTML (EEx) file and yet my snippet does not show up in the intellisense dropdown.

What am I missing?

I just skimmed the documentation, and they said to use the menu to create the new snippet file with correct name and location.

I used that menu (Ctrl-Shift-P -> “Configure User Snipper” -> “HTML (EEx)”) and it created a ~/.config/VSCodium/User/snippets/HTML (EEx).json for me. You might need to adjust that path depending on the flavor of VS Code you use.

1 Like

It works perfectly. Thank you!