From 58a40597c255495672f68771fa58c7a06191cd8a Mon Sep 17 00:00:00 2001 From: Russ Schaaf Date: Sat, 31 Aug 2024 14:22:41 -0700 Subject: [PATCH] Added github-workflow-actions as a YAML variant --- package.json | 40 + .../github-actions-workflow.code-snippets | 374 ++++++ ...-actions-workflow.embedded.tmLanguage.json | 1103 +++++++++++++++++ utilities/syntax_assembler.js | 9 + utilities/syntax_templates/yaml_syntax.js | 2 +- 5 files changed, 1527 insertions(+), 1 deletion(-) create mode 100644 snippets/github-actions-workflow.code-snippets create mode 100644 syntaxes/github-actions-workflow.embedded.tmLanguage.json diff --git a/package.json b/package.json index 7695a0b..c26671b 100644 --- a/package.json +++ b/package.json @@ -232,6 +232,46 @@ "meta.embedded.block.Markdown.yaml": "Markdown" } }, + { + "scopeName": "source.yaml.embedded.codeblock", + "injectTo": [ + "source.github-actions-workflow" + ], + "path": "syntaxes/github-actions-workflow.embedded.tmLanguage.json", + "embeddedLanguages": { + "meta.embedded.block.bat.github-actions-workflow": "bat", + "meta.embedded.block.cpp.github-actions-workflow": "cpp", + "meta.embedded.block.css.github-actions-workflow": "css", + "meta.embedded.block.html.github-actions-workflow": "html", + "meta.embedded.block.ini.github-actions-workflow": "ini", + "meta.embedded.block.javascript.github-actions-workflow": "javascript", + "meta.embedded.block.json.github-actions-workflow": "json", + "meta.embedded.block.jsonc.github-actions-workflow": "jsonc", + "meta.embedded.block.python.github-actions-workflow": "python", + "meta.embedded.block.shellscript.github-actions-workflow": "shellscript", + "meta.embedded.block.sql.github-actions-workflow": "sql", + "meta.embedded.block.toml.github-actions-workflow": "toml", + "meta.embedded.block.xml.github-actions-workflow": "xml", + "meta.embedded.block.yaml.github-actions-workflow": "yaml", + "meta.embedded.block.c.github-actions-workflow": "c", + "meta.embedded.block.hlsl.github-actions-workflow": "hlsl", + "meta.embedded.block.glsl.github-actions-workflow": "glsl", + "meta.embedded.block.metal.github-actions-workflow": "metal", + "meta.embedded.block.wgsl.github-actions-workflow": "wgsl", + "meta.embedded.block.lua.github-actions-workflow": "lua", + "meta.embedded.block.makefile.github-actions-workflow": "makefile", + "meta.embedded.block.graphql.github-actions-workflow": "graphql", + "meta.embedded.block.typescript.github-actions-workflow": "typescript", + "meta.embedded.block.latex.github-actions-workflow": "latex", + "meta.embedded.block.tex.github-actions-workflow": "tex", + "meta.embedded.block.dot.github-actions-workflow": "dot", + "meta.embedded.block.arm.github-actions-workflow": "arm", + "meta.embedded.block.asm-intel-x86-generic.github-actions-workflow": "asm-intel-x86-generic", + "meta.embedded.block.handlebars.github-actions-workflow": "handlebars", + "meta.embedded.block.powershell.github-actions-workflow": "powershell", + "meta.embedded.block.Markdown.github-actions-workflow": "Markdown" + } + }, { "scopeName": "source.js.embedded.codeblock", "injectTo": [ diff --git a/snippets/github-actions-workflow.code-snippets b/snippets/github-actions-workflow.code-snippets new file mode 100644 index 0000000..fad8a37 --- /dev/null +++ b/snippets/github-actions-workflow.code-snippets @@ -0,0 +1,374 @@ +{ + "Batch code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "bat" + ], + "description": "Insert a Batch code block string", + "body": [ + "| #bat", + "\t$0", + "" + ] + }, + "C++ code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "cpp" + ], + "description": "Insert a C++ code block string", + "body": [ + "| #cpp", + "\t$0", + "" + ] + }, + "CSS code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "css" + ], + "description": "Insert a CSS code block string", + "body": [ + "| #css", + "\t$0", + "" + ] + }, + "HTML code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "html" + ], + "description": "Insert a HTML code block string", + "body": [ + "| #html", + "\t$0", + "" + ] + }, + "INI code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "ini" + ], + "description": "Insert a INI code block string", + "body": [ + "| #ini", + "\t$0", + "" + ] + }, + "Javascript code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "js" + ], + "description": "Insert a Javascript code block string", + "body": [ + "| #js", + "\t$0", + "" + ] + }, + "JSON code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "json" + ], + "description": "Insert a JSON code block string", + "body": [ + "| #json", + "\t$0", + "" + ] + }, + "JSONC code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "jsonc" + ], + "description": "Insert a JSONC code block string", + "body": [ + "| #jsonc", + "\t$0", + "" + ] + }, + "Python code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "py" + ], + "description": "Insert a Python code block string", + "body": [ + "| #py", + "\t$0", + "" + ] + }, + "Shell code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "sh" + ], + "description": "Insert a Shell code block string", + "body": [ + "| #sh", + "\t$0", + "" + ] + }, + "SQL code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "sql" + ], + "description": "Insert a SQL code block string", + "body": [ + "| #sql", + "\t$0", + "" + ] + }, + "TOML code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "toml" + ], + "description": "Insert a TOML code block string", + "body": [ + "| #toml", + "\t$0", + "" + ] + }, + "XML code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "xml" + ], + "description": "Insert a XML code block string", + "body": [ + "| #xml", + "\t$0", + "" + ] + }, + "YAML code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "yaml" + ], + "description": "Insert a YAML code block string", + "body": [ + "| #yaml", + "\t$0", + "" + ] + }, + "C code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "c" + ], + "description": "Insert a C code block string", + "body": [ + "| #c", + "\t$0", + "" + ] + }, + "HLSL code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "hlsl" + ], + "description": "Insert a HLSL code block string", + "body": [ + "| #hlsl", + "\t$0", + "" + ] + }, + "GLSL code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "glsl" + ], + "description": "Insert a GLSL code block string", + "body": [ + "| #glsl", + "\t$0", + "" + ] + }, + "Metal code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "metal" + ], + "description": "Insert a Metal code block string", + "body": [ + "| #metal", + "\t$0", + "" + ] + }, + "WGSL code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "wgsl" + ], + "description": "Insert a WGSL code block string", + "body": [ + "| #wgsl", + "\t$0", + "" + ] + }, + "Lua code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "lua" + ], + "description": "Insert a Lua code block string", + "body": [ + "| #lua", + "\t$0", + "" + ] + }, + "Makefile code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "make" + ], + "description": "Insert a Makefile code block string", + "body": [ + "| #make", + "\t$0", + "" + ] + }, + "GraphQL code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "graphql" + ], + "description": "Insert a GraphQL code block string", + "body": [ + "| #graphql", + "\t$0", + "" + ] + }, + "TypeScript code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "typescript" + ], + "description": "Insert a TypeScript code block string", + "body": [ + "| #typescript", + "\t$0", + "" + ] + }, + "LaTeX code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "latex" + ], + "description": "Insert a LaTeX code block string", + "body": [ + "| #latex", + "\t$0", + "" + ] + }, + "TeX code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "tex" + ], + "description": "Insert a TeX code block string", + "body": [ + "| #tex", + "\t$0", + "" + ] + }, + "Graphviz code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "graphviz" + ], + "description": "Insert a Graphviz code block string", + "body": [ + "| #graphviz", + "\t$0", + "" + ] + }, + "ARM Assembly code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "arm" + ], + "description": "Insert a ARM Assembly code block string", + "body": [ + "| #arm", + "\t$0", + "" + ] + }, + "x86 / x64 Assembly code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "x86" + ], + "description": "Insert a x86 / x64 Assembly code block string", + "body": [ + "| #x86", + "\t$0", + "" + ] + }, + "Handlebars code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "hbs" + ], + "description": "Insert a Handlebars code block string", + "body": [ + "| #hbs", + "\t$0", + "" + ] + }, + "PowerShell code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "ps1" + ], + "description": "Insert a PowerShell code block string", + "body": [ + "| #ps1", + "\t$0", + "" + ] + }, + "Markdown code block (string)": { + "scope": "github-actions-workflow", + "prefix": [ + "md" + ], + "description": "Insert a Markdown code block string", + "body": [ + "| #md", + "\t$0", + "" + ] + } +} \ No newline at end of file diff --git a/syntaxes/github-actions-workflow.embedded.tmLanguage.json b/syntaxes/github-actions-workflow.embedded.tmLanguage.json new file mode 100644 index 0000000..2620e42 --- /dev/null +++ b/syntaxes/github-actions-workflow.embedded.tmLanguage.json @@ -0,0 +1,1103 @@ +{ + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "comment": "This file has been automatically generated by syntax_assembler.js\nDO NOT HAND EDIT IT - changes will be lost.", + "injectionSelector": "L:source.github-actions-workflow -string -comment", + "scopeName": "source.yaml.embedded.codeblock", + "patterns": [ + { + "include": "#block-scalar-with-embedding" + } + ], + "repository": { + "block-scalar-with-embedding": { + "comment": "These patterns all match YAML block scalar strings and select one language.The syntax is injected into https://github.com/microsoft/vscode/blob/main/extensions/yaml/syntaxes/yaml.tmLanguage.json", + "patterns": [ + { + "comment": "Batch-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:bat) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.batchfile" + } + ], + "name": "meta.embedded.block.bat.github-actions-workflow source.batchfile" + } + ] + }, + { + "comment": "C++-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:cpp|c\\+\\+) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.cpp" + } + ], + "name": "meta.embedded.block.cpp.github-actions-workflow source.cpp" + } + ] + }, + { + "comment": "CSS-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:css) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.css" + } + ], + "name": "meta.embedded.block.css.github-actions-workflow source.css" + } + ] + }, + { + "comment": "HTML-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:html) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "text.html.derivative" + } + ], + "name": "meta.embedded.block.html.github-actions-workflow text.html.derivative" + } + ] + }, + { + "comment": "INI-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:ini) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.ini" + } + ], + "name": "meta.embedded.block.ini.github-actions-workflow source.ini" + } + ] + }, + { + "comment": "Javascript-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:js|javascript) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.js" + } + ], + "name": "meta.embedded.block.javascript.github-actions-workflow source.js" + } + ] + }, + { + "comment": "JSON-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:json) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.json" + } + ], + "name": "meta.embedded.block.json.github-actions-workflow source.json" + } + ] + }, + { + "comment": "JSONC-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:jsonc) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.json.comments" + } + ], + "name": "meta.embedded.block.jsonc.github-actions-workflow source.json.comments" + } + ] + }, + { + "comment": "Python-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:py|python) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.python" + } + ], + "name": "meta.embedded.block.python.github-actions-workflow source.python" + } + ] + }, + { + "comment": "Shell-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:sh|bash|shell|shellscript) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.shell" + } + ], + "name": "meta.embedded.block.shellscript.github-actions-workflow source.shell" + } + ] + }, + { + "comment": "SQL-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:sql) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.sql" + } + ], + "name": "meta.embedded.block.sql.github-actions-workflow source.sql" + } + ] + }, + { + "comment": "TOML-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:toml) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.toml" + } + ], + "name": "meta.embedded.block.toml.github-actions-workflow source.toml" + } + ] + }, + { + "comment": "XML-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:xml) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "text.xml" + } + ], + "name": "meta.embedded.block.xml.github-actions-workflow text.xml" + } + ] + }, + { + "comment": "YAML-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:yaml) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.yaml" + } + ], + "name": "meta.embedded.block.yaml.github-actions-workflow source.yaml" + } + ] + }, + { + "comment": "C-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:c) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.c" + } + ], + "name": "meta.embedded.block.c.github-actions-workflow source.c" + } + ] + }, + { + "comment": "HLSL-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:hlsl) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.hlsl" + } + ], + "name": "meta.embedded.block.hlsl.github-actions-workflow source.hlsl" + } + ] + }, + { + "comment": "GLSL-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:glsl) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.glsl" + } + ], + "name": "meta.embedded.block.glsl.github-actions-workflow source.glsl" + } + ] + }, + { + "comment": "Metal-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:metal) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.metal" + } + ], + "name": "meta.embedded.block.metal.github-actions-workflow source.metal" + } + ] + }, + { + "comment": "WGSL-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:wgsl) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.wgsl" + } + ], + "name": "meta.embedded.block.wgsl.github-actions-workflow source.wgsl" + } + ] + }, + { + "comment": "Lua-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:lua) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.lua" + } + ], + "name": "meta.embedded.block.lua.github-actions-workflow source.lua" + } + ] + }, + { + "comment": "Makefile-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:make|makefile) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.makefile" + } + ], + "name": "meta.embedded.block.makefile.github-actions-workflow source.makefile" + } + ] + }, + { + "comment": "GraphQL-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:graphql|gql) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.graphql" + } + ], + "name": "meta.embedded.block.graphql.github-actions-workflow source.graphql" + } + ] + }, + { + "comment": "TypeScript-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:typescript|ts) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.ts" + } + ], + "name": "meta.embedded.block.typescript.github-actions-workflow source.ts" + } + ] + }, + { + "comment": "LaTeX-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:latex) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "text.tex.latex" + } + ], + "name": "meta.embedded.block.latex.github-actions-workflow text.tex.latex" + } + ] + }, + { + "comment": "TeX-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:tex) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "text.tex" + } + ], + "name": "meta.embedded.block.tex.github-actions-workflow text.tex" + } + ] + }, + { + "comment": "Graphviz-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:graphviz|dot) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.dot" + } + ], + "name": "meta.embedded.block.dot.github-actions-workflow source.dot" + } + ] + }, + { + "comment": "ARM Assembly-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:arm) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.arm" + } + ], + "name": "meta.embedded.block.arm.github-actions-workflow source.arm" + } + ] + }, + { + "comment": "x86 / x64 Assembly-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:x86|x86_64|x64) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.asm.x86_64" + } + ], + "name": "meta.embedded.block.asm-intel-x86-generic.github-actions-workflow source.asm.x86_64" + } + ] + }, + { + "comment": "Handlebars-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:hbs|handlebars) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "text.html.handlebars" + } + ], + "name": "meta.embedded.block.handlebars.github-actions-workflow text.html.handlebars" + } + ] + }, + { + "comment": "PowerShell-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:ps1|powershell) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "source.powershell" + } + ], + "name": "meta.embedded.block.powershell.github-actions-workflow source.powershell" + } + ] + }, + { + "comment": "Markdown-formatted block scalar strings", + "name": "string.quoted.multi.embedded.yaml", + "begin": "(?x)\n(?:(\\|)|(>)) ([1-9])? ([-+])? \\s* \n( \\# (?i:md|markdown) ) \\b \\s* \\n?", + "beginCaptures": { + "1": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "2": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "3": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "4": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "5": { + "name": "meta.encoding.yaml" + } + }, + "end": "^(?=\\S)|(?!\\G)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|\\s*$)", + "patterns": [ + { + "include": "text.html.markdown" + } + ], + "name": "meta.embedded.block.Markdown.github-actions-workflow text.html.markdown" + } + ] + } + ] + } + } +} \ No newline at end of file diff --git a/utilities/syntax_assembler.js b/utilities/syntax_assembler.js index 663935c..0d52232 100755 --- a/utilities/syntax_assembler.js +++ b/utilities/syntax_assembler.js @@ -83,6 +83,15 @@ const HOST_LANGUAGE_SPECS = [ snippet_start: '| #', snippet_end: '', }, + { + file: 'github-actions-workflow.embedded.tmLanguage.json', + root_scopes: ['source.github-actions-workflow'], + syntax_builder: buildYamlSyntax, + vsname: 'github-actions-workflow', + embedded_scope: 'source.yaml.embedded.codeblock', + snippet_start: '| #', + snippet_end: '', + }, { file: 'javascript.embedded.tmLanguage.json', root_scopes: ['source.js'], diff --git a/utilities/syntax_templates/yaml_syntax.js b/utilities/syntax_templates/yaml_syntax.js index 0ddfe6b..fb5122a 100644 --- a/utilities/syntax_templates/yaml_syntax.js +++ b/utilities/syntax_templates/yaml_syntax.js @@ -40,7 +40,7 @@ export function buildYamlSyntax(hostSpec, embeddedSpecs) { '$schema': 'https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json', 'comment': `This file has been automatically generated by syntax_assembler.js DO NOT HAND EDIT IT - changes will be lost.`, - 'injectionSelector': 'L:source.yaml -string -comment, L:text.yaml.jinja -string -comment', + 'injectionSelector': hostSpec.root_scopes.map((scope) => `L:${scope} -string -comment`).join(', '), 'scopeName': hostSpec.embedded_scope, 'patterns': [{ 'include': '#block-scalar-with-embedding' }], 'repository': {