This is the official extension for VSCode created by the creators of Edge.js. The extension adds support for the following features.
- Syntax highlighting for both HTML and Edge
- Code folding for Edge tags
- "Go To Template" in
.edge
and.js/.ts
files - Auto-completion for components and templates
- Tags snippets
- Inbuilt helpers snippets
- AdonisJS specific snippets
Important
This extension does not perform code formatting.
Code formatting with template engine syntax embedded inside HTML is tricky and needs dedicated resources to fight edge cases. We do not have the bandwidth to work on the same right now.
Following is the list of available configuration options :
In order to benefit from autocompletion and Go-To links, the extension needs to know the directories hosting your Edge templates.
That's what this option is for : it's an object whose keys are the disk names and values the paths to the template directories, relative to the root of your project.
By default, edge.disk
has this value:
{
"edge.disks": {
"default": "resources/views"
}
}
This is perfectly suited to AdonisJS projects by default.
If you set up a secondary disk with Edge, like this
const BASE_URL = new URL('./', import.meta.url)
edge.mount('mydisk', new URL('my/sub/directory', BASE_URL))
You can configure the extension as follows:
{
"edge.disks": {
"default": "resources/views",
"mydisk": "my/sub/directory"
}
}
If you are using packages such as edge-uikit
or @dimer/docs-theme
which add extra templates, you can configure new disks like this:
{
"edge.disks": {
"default": "resources/views",
"docs": "node_modules/dimerapp/docs-theme/build/templates",
"ui": "node_modules/edge-uikit/build/views"
}
}
If you want to use Emmet in your Edge templates, you can add the following configuration:
{
"emmet.includeLanguages": {
"edge": "html"
}
}
Following is the list of available snippets
Triggers | Output |
---|---|
if
|
|
elseif
|
|
else
|
|
if-else
|
|
unless
|
|
each
|
|
each-index
|
|
component
|
|
component-inline
|
|
slot
|
|
inject
|
|
eval
|
|
newError
|
|
include
|
|
include-if
|
|
svg
|
|
debugger
|
|
let
|
|
assign
|
|
vite
|
|
Triggers | Output |
---|---|
props.toAttrs
|
|
props.merge
|
|
props.only
|
|
props.except
|
|
slots
|
|
filename
|
|
caller
|
|
nl2br
|
|
inspect
|
|
truncate
|
|
excerpt
|
|
html
|
|
stringify
|
|
camelCase
|
|
snakeCase |
|
dashCase |
|
pascalCase |
|
capitalCase |
|
capitalCase |
|
sentenceCase |
|
dotCase |
|
noCase |
|
titleCase |
|
pluralize |
|
sentence |
|
prettyMs |
|
toMs |
|
prettyBytes |
|
toBytes |
|
ordinal |
|
Triggers | Output |
---|---|
route
|
|
signedRoute
|
|
flashMessages
|
|
asset
|
|
csrfField
|
|
cspNonce
|
|
auth
|
|
config
|
|
t
|
|