Skip to content

Commit

Permalink
feat: add syntax highlighting for new @js tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-R44 committed Aug 28, 2022
1 parent 8d99ba3 commit ee3df03
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,8 @@
"path": "./syntaxes/edge.tmLanguage.json",
"embeddedLanguages": {
"source.css": "css",
"source.js": "javascript"
"source.js": "javascript",
"meta.embedded.block.javascript": "javascript"
}
}
],
Expand Down
30 changes: 29 additions & 1 deletion syntaxes/edge.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,34 @@
"injections": {
"text.html.edge - (meta.embedded | meta.tag | comment.block.edge), L:(text.html.edge meta.tag - comment.block.edge), L:(source.js.embedded.html - comment.block.edge)": {
"patterns": [
{
"begin": "(@js)\\(.+\\)",
"beginCaptures": {
"1": {
"name": "keyword.edge"
},
"2": {
"name": "begin.bracket.round.edge"
}
},
"name": "meta.directive.edge",
"end": "@end",
"endCaptures": {
"0": {
"name": "entity.name.function.edge"
}
},
"patterns": [
{
"contentName": "meta.embedded.block.javascript",
"patterns": [
{
"include": "source.js"
}
]
}
]
},
{
"begin": "{{--",
"beginCaptures": {
Expand Down Expand Up @@ -283,7 +311,7 @@
]
},
{
"begin": "(?x)\n(?<![A-Za-z0-9_@]) # Prepended @ or literal character escapes the sequence\n(\n @\\!?\n (?i: # Ordering not important as we everything will be matched up to opening parentheses\n auth\n |break\n |can\n |cannot\n |case\n |choice\n |component\n |continue\n |each\n |elsecan\n |elsecannot\n |elseif\n |empty\n |extends\n |layout\n |inlineSvg\n |for\n |foreach\n |forelse\n |guest\n |hassection\n |if\n |include\n |includefirst\n |includeif\n |includewhen\n |inject\n |isset\n |json\n |lang\n |prepend\n |push\n |section\n |slot\n |stack\n |switch\n |unless\n |unset\n |while\n |yield\n |servers\n |task\n |story\n |slack\n |method\n |dump\n |js\n )\n [\\t ]* # Whitespace between name and parentheses\n)\n(\\() # Followed by opening parentheses",
"begin": "(?x)\n(?<![A-Za-z0-9_@]) # Prepended @ or literal character escapes the sequence\n(\n @\\!?\n (?i: # Ordering not important as we everything will be matched up to opening parentheses\n auth\n |break\n |can\n |cannot\n |case\n |choice\n |component\n |continue\n |each\n |elsecan\n |elsecannot\n |elseif\n |empty\n |extends\n |layout\n |inlineSvg\n |for\n |foreach\n |forelse\n |guest\n |hassection\n |if\n |include\n |includefirst\n |includeif\n |includewhen\n |inject\n |isset\n |json\n |lang\n |prepend\n |push\n |section\n |slot\n |stack\n |switch\n |unless\n |unset\n |while\n |yield\n |servers\n |task\n |story\n |slack\n |method\n |dump\n )\n [\\t ]* # Whitespace between name and parentheses\n)\n(\\() # Followed by opening parentheses",
"beginCaptures": {
"1": {
"name": "keyword.edge"
Expand Down

0 comments on commit ee3df03

Please sign in to comment.