From c3df4d834e613a49009ea065a648f7f9a0e84ac3 Mon Sep 17 00:00:00 2001 From: reduckted Date: Sat, 18 Jul 2026 23:02:03 +1000 Subject: [PATCH 1/9] Configured workspace for linting JS scripts. --- .eslintrc.json | 2 +- .vscode/settings.json | 3 ++- tsconfig.eslint.json | 7 +++++++ 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 tsconfig.eslint.json diff --git a/.eslintrc.json b/.eslintrc.json index 5d1ee154..492952bf 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -12,7 +12,7 @@ "ignorePatterns": ["src/external"], "parser": "@typescript-eslint/parser", "parserOptions": { - "project": "./tsconfig.json" + "project": "./tsconfig.eslint.json" }, "plugins": ["@typescript-eslint", "prettier"], "reportUnusedDisableDirectives": true, diff --git a/.vscode/settings.json b/.vscode/settings.json index ea167488..0a5b2599 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,8 @@ { "github-actions.workflows.pinned.workflows": [".github/workflows/build.yml"], "editor.formatOnSave": true, - "[typescript]": { + "js/ts.tsdk.path": "node_modules/typescript/lib", + "[typescript][javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" } } diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json new file mode 100644 index 00000000..f0232d54 --- /dev/null +++ b/tsconfig.eslint.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "include": ["src", "script/grammars/*.mjs"], + "compilerOptions": { + "allowJs": true + } +} From 7a3a75e715867fbec3f73bf3fd66f630d7f5efe2 Mon Sep 17 00:00:00 2001 From: reduckted Date: Sun, 9 Aug 2026 20:13:17 +1000 Subject: [PATCH 2/9] Created scripts to generate grammars. --- package.json | 3 +- script/grammars/common.mjs | 412 ++++++++++++++++ script/grammars/generate-github-script.mjs | 96 ++++ script/grammars/generate-run.mjs | 532 +++++++++++++++++++++ script/grammars/generate.mjs | 14 + 5 files changed, 1056 insertions(+), 1 deletion(-) create mode 100644 script/grammars/common.mjs create mode 100644 script/grammars/generate-github-script.mjs create mode 100644 script/grammars/generate-run.mjs create mode 100644 script/grammars/generate.mjs diff --git a/package.json b/package.json index 8b4e7dd9..987e8720 100644 --- a/package.json +++ b/package.json @@ -555,7 +555,8 @@ "format": "prettier --write \"**/*.ts\"", "format-check": "prettier --check \"**/*.ts\"", "test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest", - "test-watch": "NODE_OPTIONS=\"--experimental-vm-modules\" jest --watch" + "test-watch": "NODE_OPTIONS=\"--experimental-vm-modules\" jest --watch", + "grammars-generate": "node ./script/grammars/generate.mjs" }, "devDependencies": { "@types/jest": "^29.0.3", diff --git a/script/grammars/common.mjs b/script/grammars/common.mjs new file mode 100644 index 00000000..c445ae2a --- /dev/null +++ b/script/grammars/common.mjs @@ -0,0 +1,412 @@ +/* eslint-env node */ + +// @ts-check + +import fs from "node:fs/promises"; +import path from "node:path"; +import {fileURLToPath} from "node:url"; + +/** + * Common syntax patterns and captures. + */ +export const SYNTAX = { + propertyName: {name: "entity.name.tag.yaml"}, + colon: {name: "punctuation.separator.key-value.mapping.yaml"}, + dash: {name: "punctuation.definition.block.sequence.item.yaml"}, + unquotedString: {name: "string.unquoted.plain.out.yaml"}, + commentOrIllegalCharacters: { + patterns: [ + {include: "source.github-actions-workflow#comment"}, + {match: ".+", name: "invalid.illegal.expected-comment-or-newline.yaml"} + ] + }, + anyWorkflowSyntax: {include: "source.github-actions-workflow"} +}; + +/** + * Creates a pattern that matches when the line starts with an indent + * that is less than what the given pattern matches. Blank lines and comment lines are ignored. + * @param {string} indent The pattern that matches the indent. + * @returns The full pattern. + */ +export function indentIsLessThan(indent) { + // Match when the line: + // - Does not start with the given pattern, and + // - Does not contain only whitespace, and + // - Does not contain only a comment. + return String.raw`^(?!${indent}|[ ]*$|[ ]*#.*$)`; +} + +/** + * Creates a pattern that matches when the line starts with an indent that is + * less than or equal to what the given pattern matches. Blank lines and comment lines are ignored. + * @param {string} indent The pattern that matches the indent. + * @returns The full pattern. + */ +export function indentIsLessThanOrEqualTo(indent) { + // Match when the line: + // - Does not start with the given pattern plus at + // least one additional whitespace character, and + // - Does not contain only whitespace, and + // - Does not contain only a comment. + return String.raw`^(?!${indent} |[ ]*$|[ ]*#.*$)`; +} + +/** + * Creates the `begin`, `beginCaptures` and `end` properties for matching + * from the start of a property that defines an object or array (rather + * than a string value) and continues until the end of the property. + * @param {string} propertyNamePattern The pattern to match to the property name. + * @param {boolean} hasIndent Whether the property is indented. + * @returns {BeginAndEnd} The rule properties. + */ +export function matchWholeObjectProperty(propertyNamePattern, hasIndent) { + return { + ...begin( + {pattern: "^", captures: []}, + hasIndent ? {pattern: "([ ]+)", captures: [undefined]} : undefined, + { + pattern: String.raw`(${propertyNamePattern})[ ]*(:)`, + captures: [SYNTAX.propertyName, SYNTAX.colon] + }, + matchTrailingLineContent() + ), + end: hasIndent + ? // The property ends when the indent is less than or + // equal to what we matched before the property name. + indentIsLessThanOrEqualTo(String.raw`\1`) + : // The property ends when the line has no indent. + indentIsLessThanOrEqualTo("") + }; +} + +/** + * Creates the `begin`, `beginCaptures` and `end` properties for + * matching to an object and continues until the end of the property. + * The match will start from the property with the given name + * and string value, and continues to the end of the object. + * @param {string} namePattern The pattern that matches the name of the property. + * @param {string} valuePattern The pattern that matches the value of the property. + * @returns {BeginAndEnd} The rule properties. + */ +export function matchPartialObjectProperty(namePattern, valuePattern) { + return { + ...begin( + // We're matching from somewhere after the object has started, which means + // the line must be indented. If the line was not indented, then it would + // be a top-level property, which is not what we are intended to match. + {pattern: "^([ ]+)", captures: [undefined]}, + matchPropertyNameAndValue(namePattern, valuePattern), + matchTrailingLineContent() + ), + + // The property ends when the indent is less than what we matched + // before the property name. If the indent is equal to what we + // matched, then that's just another property on the same object. + end: indentIsLessThan(String.raw`\1`) + }; +} + +/** + * Creates the `begin`, `beginCaptures` and `end` properties for matching + * to a sequence item (array element). If specified, the first property + * must match the given name and match the given value pattern. + * The match will continue until the end of the sequence item. + * @param {string} [namePattern] The pattern that matches the name of the property at the start of the sequence item. + * @param {string} [valuePattern] The pattern that matches the value of the property. + * @returns {BeginAndEnd} The rule properties. + */ +export function matchSequenceItem(namePattern, valuePattern) { + return { + ...begin( + // Start with matching to just the start of the sequence + // item without a property. We need this part of the pattern + // whether or not we include a property in the match. + // Sequence items cannot be defined at the top-level, + // so there will always be an indent before the dash. + { + pattern: String.raw`^([ ]+)(-)([ ]+)`, + captures: [undefined, SYNTAX.dash, undefined] + }, + // If we need to match to a property as well, then + // include the property and value in the pattern, + // plus whatever can come after it on the line. + ...(namePattern && valuePattern + ? [matchPropertyNameAndValue(namePattern, valuePattern), matchTrailingLineContent()] + : []) + ), + + // The sequence item ends when the indent is less than the number + // of characters before the property that started the step: + // - The indent in group one + // - One space for the dash (which is group 2) + // - Whatever spaces followed the dash in group 3. + end: indentIsLessThan(String.raw`\1 \3`) + }; +} + +/** + * Generates a grammar for a block scalar property with the given name. + * @param {string} namePattern The pattern that matches the property name. + * @param {string} metaName The meta name to assign to the block. + * @param {string} source The source language to include for the block content. + * @param {boolean} isSequenceItem Indicates whether the property is at the start of a sequence item. + * @returns {Rule} The grammar rule. + */ +export function blockRule(namePattern, metaName, source, isSequenceItem) { + return { + ...begin( + {pattern: String.raw`^([ ]+)`, captures: [undefined]}, + isSequenceItem ? {pattern: "(-)([ ]+)", captures: [SYNTAX.dash, undefined]} : undefined, + matchPropertyName(namePattern), + { + pattern: String.raw`[ ]+(?:(\|)|(>))([1-9])?([-+])?`, + captures: [ + {name: "keyword.control.flow.block-scalar.literal.yaml"}, + {name: "keyword.control.flow.block-scalar.folded.yaml"}, + {name: "constant.numeric.indentation-indicator.yaml"}, + {name: "storage.modifier.chomping-indicator.yaml"} + ] + }, + matchTrailingLineContent() + ), + + // The content of the block must be indented at least one space + // more that the property name was, so we can detect the end + // of the block by a line whose indentation is less than or equal + // to the property's indentation. Don't end on blank lines so that + // we don't end the block early when there are blank lines in it. + // If we're matching to a sequence item, then the indent includes + // the dash and the whitespace between it and the property name. + end: isSequenceItem ? String.raw`^(?!\1 \3 |[ ]*$)` : String.raw`^(?!\1 |[ ]*$)`, + + patterns: [ + { + // Within the block scalar, match to an indent, and continue until + // the indent is reduced, but ignore blank lines. This range is + // marked with the meta name (which would be an `meta.embedded.*` name), + // and everything within it is matched to the specified source grammar. + begin: String.raw`^([ ]+)(?! )`, + end: String.raw`^(?!\1|[ ]*$)`, + name: metaName, + patterns: [{include: source}] + } + ] + }; +} + +/** + * Generates a grammar for a plain scalar property with the given name. + * @param {string} namePattern The pattern that matches the property name. + * @param {string} metaName The meta name to assign to the block. + * @param {string} source The source language to include for the content. + * @param {boolean} isSequenceItem Indicates whether the property is at the start of a sequence item. + * @returns {Rule} The grammar. + */ +export function plainRule(namePattern, metaName, source, isSequenceItem) { + return { + ...begin( + {pattern: "^([ ]+)", captures: [undefined]}, + isSequenceItem ? {pattern: "(-)([ ]+)", captures: [SYNTAX.dash, undefined]} : undefined, + matchPropertyName(namePattern), + // There must be at least one space after + // the colon that follows the property name. + // We don't want to capture the value though. + {pattern: "[ ]+", captures: []} + ), + + // Although the "plain scalar" is an unquoted string, it can span + // multiple lines. Each line must be indented at least one space + // more that the property name was, so we can detect the end of the + // plain scalar by a line whose indentation is less than or equal + // to the property's indentation. Don't end on blank lines so that + // we don't break the block when there are blank lines in it. + // If we're matching to a sequence item, then the indent includes + // the dash and the whitespace between it and the property name. + end: isSequenceItem ? String.raw`^(?!\1 \3 |[ ]*$)` : String.raw`^(?!\1 |[ ]*$)`, + + name: metaName, + patterns: [{include: source}] + }; +} + +/** + * Creates the capture segment that matches a property name and colon. + * @param {string} namePattern The pattern that matches the name of the property. + * @returns {CaptureSegment} + */ +function matchPropertyName(namePattern) { + return { + // The property name can optionally be followed by whitespace. + pattern: String.raw`(${namePattern})[ ]*(:)`, + captures: [SYNTAX.propertyName, SYNTAX.colon] + }; +} + +/** + * Creates the capture segment that matches a property name, colon and value. + * @param {string} namePattern The pattern that matches the name of the property. + * @param {string} valuePattern The pattern that matches the value. + * @returns {CaptureSegment} + */ +export function matchPropertyNameAndValue(namePattern, valuePattern) { + return combine(matchPropertyName(namePattern), { + // The colon must be followed by at least one space. + pattern: String.raw`[ ]+(${valuePattern})`, + captures: [SYNTAX.unquotedString] + }); +} + +/** + * Creates the capture segment that matches the content that can appear + * at the end of a line. Includes the anchor for the end of the line. + * @returns {CaptureSegment} + */ +export function matchTrailingLineContent() { + return {pattern: "([ ]+.*)?$", captures: [SYNTAX.commentOrIllegalCharacters]}; +} + +/** + * Creates a reference to a rule in the current grammar's repository. + * @param {string} rule The name of the rule. + * @returns {string} The reference to the rule. + */ +export function ref(rule) { + return `#${rule}`; +} + +/** + * Provide a type-safe way to define a rule. + * @param {string} name The name of the rule. + * @param {Rule} rule The rule definition. + * @returns {Record} The rule to include in the repository. + */ +export function rule(name, rule) { + return { + [name]: { + ...rule, + // Optionally include a content name that + // matches the rule to assist with debugging. + ...(process.env.INCLUDE_CONTENT_NAME ? {contentName: `source.github-actions-workflow.${name}`} : undefined) + } + }; +} + +/** + * Creates the `begin` and `beginCaptures` properties for a rule. + * @param {(CaptureSegment | undefined)[]} segments The segments that define the pattern and captures. + * @returns {Begin} The `begin` and `beginCaptures` properties. + */ +export function begin(...segments) { + const combined = combine(...segments); + + /** @type {Rule['beginCaptures']} */ + const beginCaptures = {}; + + for (let i = 0; i < combined.captures.length; i++) { + const capture = combined.captures[i]; + if (capture !== undefined) { + beginCaptures[i + 1] = capture; + } + } + + return {begin: combined.pattern, beginCaptures}; +} + +/** + * Combines capture segments. + * @param {(CaptureSegment | undefined)[]} segments The segments to combine. + * @returns {CaptureSegment} The combined segments. + */ +function combine(...segments) { + /** @type {CaptureSegment} */ + const result = {pattern: "", captures: []}; + + for (let segment of segments) { + // Skip undefined segments. This allows callers to set conditional + // segments to undefined within the call to `combine` instead of having + // to store a partially constructed segment in a local variable. + if (segment) { + result.pattern += segment.pattern; + result.captures.push(...segment.captures); + } + } + + return result; +} + +/** + * Writes the given grammar to a file in the `language/syntaxes` directory. + * @param {object} grammar The grammar definition. + * @param {string} name The file name. + */ +export async function writeGrammarFile(grammar, name) { + const dirname = path.dirname(fileURLToPath(import.meta.url)); + const root = path.resolve(dirname, "../.."); + const generator = path.join(dirname, "generate.mjs"); + + await fs.writeFile( + path.resolve(root, "language", "syntaxes", name), + JSON.stringify( + { + information_for_contributors: [ + `This file has been generated by '${path.relative(root, generator).replace(/\\/g, "/")}'.`, + "Any changes should be made in that script, then use `npm run grammars-generate` to regenerate this file." + ], + ...grammar + }, + undefined, + 2 + ) + "\n" + ); +} + +/** + * @typedef NameCapture + * @property {string} name The name of the capture. + */ + +/** + * @typedef IncludeCapture + * @property {string} include The name of the rule to include. + */ + +/** + * @typedef PatternsCapture + * @property {string} [begin] The pattern to match the beginning of a range. + * @property {string} [end] The pattern to match the end of a range. + * @property {(IncludeCapture | NameCapture)[]} patterns The patterns to match in the captured text. + */ + +/** + * @typedef {IncludeCapture | NameCapture | PatternsCapture} Capture + */ + +/** + * @typedef Rule + * @property {string} begin The pattern matching the beginning of the range. + * @property {Record} beginCaptures The captures for the `begin` pattern. + * @property {string} end The pattern matching the end of the range. + * @property {(IncludeCapture | NameCapture | PatternsCapture)[]} patterns The patterns to match in the content. + * @property {string} [name] The name of the matched portion. + */ + +/** + * @typedef {Rule & { contentName?: string }} RuleWithContentName + */ + +/** + * @typedef {Pick} BeginAndEnd + */ + +/** + * @typedef {Pick} Begin + */ + +/** + * @typedef CaptureSegment + * @property {string} pattern The pattern matching the beginning of the range. + * @property {(Capture | undefined)[]} captures The captures for the `begin` pattern. + * Each element corresponds to the one-based capture group. + * Use an `undefined` element to skip a capture group. + */ diff --git a/script/grammars/generate-github-script.mjs b/script/grammars/generate-github-script.mjs new file mode 100644 index 00000000..695144df --- /dev/null +++ b/script/grammars/generate-github-script.mjs @@ -0,0 +1,96 @@ +/* eslint-env node */ + +// @ts-check + +import { + blockRule, + matchPartialObjectProperty, + matchSequenceItem, + matchWholeObjectProperty, + plainRule, + ref, + rule, + SYNTAX, + writeGrammarFile +} from "./common.mjs"; + +const RULE_NAMES = { + usesActionsGitHubScript: "actions-github-script.uses", + usesActionsGitHubScriptSequenceItem: "actions-github-script.uses-sequence-item", + usesActionsGitHubScriptWith: "actions-github-script.with", + scriptBlock: "actions-github-script.script.block", + scriptPlain: "actions-github-script.script.plain" +}; + +/** + * Generates a grammar for the `script` input of the `actions/github-script` action. + */ +export async function generateGitHubScriptGrammar() { + const grammar = { + scopeName: "source.github-actions-workflow.actions-github-script", + injectionSelector: "L:source.github-actions-workflow", + patterns: [ + {include: ref(RULE_NAMES.usesActionsGitHubScript)}, + {include: ref(RULE_NAMES.usesActionsGitHubScriptSequenceItem)} + ], + repository: { + // This rule matches to a `uses: actions/github-script@...` property + // that does not start a sequence item. We assume that this + // property is within a step because it's unlikely to occur + // anywhere else. The match continues until the end of the step. + ...rule(RULE_NAMES.usesActionsGitHubScript, { + ...matchPartialObjectProperty("uses", String.raw`actions/github-script@(?:\S+)`), + + patterns: [ + // Match to the step's `with` property. + {include: ref(RULE_NAMES.usesActionsGitHubScriptWith)}, + + // Anything else can be handled by the workflow grammar. + SYNTAX.anyWorkflowSyntax + ] + }), + + // This rule is similar to the previous step, except it matches + // a `uses: actions/github-script@...` property that starts a + // sequence item. The match continues until the end of the step. + ...rule(RULE_NAMES.usesActionsGitHubScriptSequenceItem, { + ...matchSequenceItem("uses", String.raw`actions\/github-script@\S+`), + + patterns: [ + // Match to the step's `with` property. + {include: ref(RULE_NAMES.usesActionsGitHubScriptWith)}, + + // Anything else can be handled by the workflow grammar. + SYNTAX.anyWorkflowSyntax + ] + }), + + // This rule matches to a `with` property. It's used to + // ensure that we don't match to a `script` property + // that is not within the step's `with` property. + ...rule(RULE_NAMES.usesActionsGitHubScriptWith, { + ...matchWholeObjectProperty("with", true), + + patterns: [ + // Match to the `script` property as either + // a plain flow scalar or a block scalar. + {include: ref(RULE_NAMES.scriptBlock)}, + {include: ref(RULE_NAMES.scriptPlain)}, + + // Anything else can be handled by the workflow grammar. + SYNTAX.anyWorkflowSyntax + ] + }), + + // This rule matches the `script` + // property when it is a block scalar. + [RULE_NAMES.scriptBlock]: blockRule("script", "meta.embedded.inline.javascript", "source.js", false), + + // This rule matches the `script` + // property when it is a plain flow scalar. + [RULE_NAMES.scriptPlain]: plainRule("script", "meta.embedded.inline.javascript", "source.js", false) + } + }; + + await writeGrammarFile(grammar, "actions-github-script.tmGrammar.json"); +} diff --git a/script/grammars/generate-run.mjs b/script/grammars/generate-run.mjs new file mode 100644 index 00000000..a5790e77 --- /dev/null +++ b/script/grammars/generate-run.mjs @@ -0,0 +1,532 @@ +/* eslint-env node */ + +// @ts-check + +import { + begin, + blockRule, + indentIsLessThanOrEqualTo, + matchPartialObjectProperty, + matchPropertyNameAndValue, + matchSequenceItem, + matchTrailingLineContent, + matchWholeObjectProperty, + plainRule, + ref, + rule, + SYNTAX, + writeGrammarFile +} from "./common.mjs"; + +/** + * Names of rules that are not specific to a shell. + */ +const RULE_NAMES = { + on: "on", + runs: "runs", + workflowDefaults: "defaults", + workflowDefaultsRun: "defaults.run", + jobs: "jobs", + job: "job", + jobDefaults: "job.defaults", + jobDefaultsRun: "job.defaults.run", + stepsNoDefaultShell: "steps.no-default-shell", + step: "step.no-default-shell" +}; + +const MATCH_NOTHING = "^(?!.*)$"; + +/** + * Generates a grammar for the `run` input of steps. + */ +export async function generateRunGrammar() { + const languages = [ + defineLanguage("shell", ["bash", "sh"]), + defineLanguage("batchfile", ["cmd"]), + defineLanguage("powershell", ["pwsh", "powershell"]), + defineLanguage("python", ["python"]) + ]; + + const grammar = { + scopeName: "source.github-actions-workflow.run", + injectionSelector: "L:source.github-actions-workflow", + patterns: [{include: ref(RULE_NAMES.on)}, {include: ref(RULE_NAMES.runs)}], + repository: { + // This rule matches the workflow's `on` property. We cannot define + // the "jobs" rule as a top-level pattern, because doing that means + // it takes precedence over the "jobs with a default shell" rule that + // we only include within other rules. To avoid that, we need a top-level + // rule that captures the entire workflow, and then we include the rules + // for other properties within it to narrow their scope. Since every + // workflow requires an `on` property, we can match to that property. + ...rule(RULE_NAMES.on, { + ...matchWholeObjectProperty("on", false), + + // Match to the end of the file instead of the end of the property. + // Do this by using an end pattern that won't match to any line. + end: MATCH_NOTHING, + + patterns: [ + // Here we include the top-level properties that we can match to. + {include: ref(RULE_NAMES.workflowDefaults)}, + {include: ref(RULE_NAMES.jobs)}, + + // Anything else can be handled by the workflow grammar. + SYNTAX.anyWorkflowSyntax + ] + }), + + // This rule matches a composite action's `runs` property. + ...rule(RULE_NAMES.runs, { + ...matchWholeObjectProperty("runs", false), + + patterns: [ + // Composite actions do not have a default shell, so we + // only need to match to the `steps` property. Within that + // we can use the same rules for the steps in a workflow. + {include: ref(RULE_NAMES.stepsNoDefaultShell)}, + + // Anything else can be handled by the workflow grammar. + SYNTAX.anyWorkflowSyntax + ] + }), + + // This rule matches the `defaults` property at the workflow-level, + // which allows the default shell to be set for the entire + // workflow. It only works as intended when the `defaults` + // property is defined before the `jobs` property. + ...rule(RULE_NAMES.workflowDefaults, { + ...matchWholeObjectProperty("defaults", false), + + patterns: [ + // Match the `run` property in the defaults. + // If this matches, this will extend the end of + // this rule's range to the end of the workflow. + {include: ref(RULE_NAMES.workflowDefaultsRun)}, + + // Anything else can be handled by the workflow grammar. + SYNTAX.anyWorkflowSyntax + ] + }), + + // This rule matches the `run` property within the workflow's `defaults` + // property, which allows the default shell to be set for the workflow. + ...rule(RULE_NAMES.workflowDefaultsRun, { + ...matchWholeObjectProperty("run", true), + + patterns: [ + // Match to the `jobs` property. If we match to this, then + // we didn't match to a default shell, because the default + // shell match would continue to the end of the workflow. + {include: ref(RULE_NAMES.jobs)}, + + // Match to the default shell property for each language. + // These rules will match the `shell` property in the defaults + // and continue all the way through to the end of the workflow. + ...languages.map(language => ({include: ref(language.rules.workflowDefaultsRunShell)})), + + // Anything else can be handled by the workflow grammar. + SYNTAX.anyWorkflowSyntax + ] + }), + + // This rule matches the `jobs` property + // and all of its child properties. It is used + // as a way to find the individual job properties. + ...rule(RULE_NAMES.jobs, jobs(RULE_NAMES.job)), + + // This rule matches the `job` property and + // all of its child properties. It is used + // to detect the default shell for the job. + ...rule(RULE_NAMES.job, job(RULE_NAMES.stepsNoDefaultShell)), + + // This rule matches the `defaults` property within a job, + // which allows the default shell to be set for the job. + // It only works as intended when the `defaults` + // property is defined before the `steps` property. + ...rule(RULE_NAMES.jobDefaults, { + ...matchWholeObjectProperty("defaults", true), + + patterns: [ + // Match the `run` property in the defaults. + // If this matches, this will extend the end of + // this rule's range to the end of the steps. + {include: ref(RULE_NAMES.jobDefaultsRun)}, + + // Anything else can be handled by the workflow grammar. + SYNTAX.anyWorkflowSyntax + ] + }), + + // This rule matches the `run` property within a job's `defaults` + // property, which allows the default shell to be set for the job. + ...rule(RULE_NAMES.jobDefaultsRun, { + ...matchWholeObjectProperty("run", true), + + patterns: [ + // Match to the `steps` property. If we match to this, then + // we didn't match to a default shell, because the default + // shell match would continue to the end of the job. + {include: ref(RULE_NAMES.stepsNoDefaultShell)}, + + // Match to the default shell property for each language. + // These rules will match the `shell` property in the defaults + // and continue all the way through to the end of the job. + ...languages.map(language => ({include: ref(language.rules.jobDefaultsRunShell)})), + + // Anything else can be handled by the workflow grammar. + SYNTAX.anyWorkflowSyntax + ] + }), + + // This rule matches the `steps` property. It will only + // be tested when the job does not have a default shell. + ...rule(RULE_NAMES.stepsNoDefaultShell, { + ...matchWholeObjectProperty("steps", true), + + patterns: [ + // Match to a step that starts with a `shell` property. This must + // be declared before the next pattern because that next pattern + // will match to _any_ step, regardless of what it starts with. + ...languages.map(language => ({include: ref(language.rules.stepStartingWithShell)})), + + // Match to any step. + {include: ref(RULE_NAMES.step)}, + + // Anything else can be handled by the workflow grammar. + SYNTAX.anyWorkflowSyntax + ] + }), + + // Define a rule that matches to a step. Although this matches + // to any step, it will only end up matching to steps that do + // not start with a `shell` property because a step that starts + // with a shell property will be matched before this rule is tested. + // This rule is only used when there is no default shell defined. + ...rule(RULE_NAMES.step, { + // Match to a sequence item. This rule is only used + // within the `steps` property, so we can guarantee + // that any sequence item we match to is a step. + ...matchSequenceItem(), + + patterns: [ + // Match to the `shell` property for each language. That allows + // us to set the shell for everything that follows it in the step. + ...languages.map(language => ({include: ref(language.rules.stepShell)})), + + // Anything else can be handled by the workflow grammar. + SYNTAX.anyWorkflowSyntax + ] + }), + + ...languages + .map(language => ({ + // This rule matches the `shell` property in a workflow's + // `defaults.run` property for a specific language. + ...rule(language.rules.workflowDefaultsRunShell, { + ...matchPartialObjectProperty("shell", language.shellPattern), + + // The match needs to continue to the end of the workflow + // instead of to the end of the object. It needs to do this + // because we want to match to the `jobs` property so that we + // can apply the default shell to that property and its children. + // Do this by using a pattern that won't match anything. + end: MATCH_NOTHING, + + patterns: [ + // Match to the jobs property. The jobs will + // use the default shell for this language. + {include: ref(language.rules.jobsDefaultShell)}, + + // Anything else can be handled by the workflow grammar. + SYNTAX.anyWorkflowSyntax + ] + }), + + // This rule matches the `jobs` property + // when the workflow has a default shell. + ...rule(language.rules.jobsDefaultShell, jobs(language.rules.jobDefaultShell)), + + // This rule matches the `job` property + // when the workflow has a default shell. + ...rule(language.rules.jobDefaultShell, job(language.rules.stepsDefaultShell)), + + // This rule matches the `shell` property in a job's + // `defaults.run` property for a specific language. + ...rule(language.rules.jobDefaultsRunShell, { + ...begin( + { + // We want this rule to cover the steps in the job. To do this, we + // need to know the amount of whitespace used for one indent level. + // We know that a job has one level of indentation. The `defaults` + // property for the job will therefore have two levels, the `run` + // property will have three and the `shell` property will have four. + // Match to four equal levels of spaces, capturing the first level. + pattern: String.raw`^([ ]+)\1{3}`, + captures: [undefined] + }, + matchPropertyNameAndValue("shell", language.shellPattern), + matchTrailingLineContent() + ), + + // End the match at the end of the job. That will be when the + // line has less than or equal to one level of indentation. + end: indentIsLessThanOrEqualTo(String.raw`\1`), + + patterns: [ + // Match to the steps property. The steps will + // use the default shell for this language. + {include: ref(language.rules.stepsDefaultShell)}, + + // Anything else can be handled by the workflow grammar. + SYNTAX.anyWorkflowSyntax + ] + }), + + // This rule matches the `steps` property in a job that + // has a default shell defined for a specific language. + ...rule(language.rules.stepsDefaultShell, { + ...matchWholeObjectProperty("steps", true), + + // Within a `steps` property, we can handle steps that start with + // a `shell` property (the default does not apply), or steps that + // don't start with a `shell` property (the default might apply). + // hey must be defined in this order. If the `step` rule is included + // first, then all steps will match to that and nothing will match to + // the shell-step rule. + patterns: [ + // Match to a step that starts with a `shell` property. That step + // is overriding the default shell. We need one pattern for each language. + ...languages.map(language => ({include: ref(language.rules.stepStartingWithShell)})), + + // Match to a step that starts with a `run` property. + // The value can be either a block scalar, or a plain + // flow scalar. We require the shell to be declared + // before the `run` property, which means steps starting + // with a `run` property will be using the default shell. + {include: ref(language.rules.stepStartingWithRunBlock)}, + {include: ref(language.rules.stepStartingWithRunPlain)}, + + // Match to a step that does not start with a `shell` + // or `run` property. That step may define a `shell` + // property later, in which case that will override the + // default shell, but if it doesn't define a `shell` + // property, then it will use the default shell. + {include: ref(language.rules.stepMaybeDefaultShell)}, + + // Anything else can be handled by the workflow grammar. + SYNTAX.anyWorkflowSyntax + ] + }), + + // This rule matches to a step that starts with a `shell` property. + // Note that this is different to the plain `step` rule. This rule is + // used to override the default shell, so we specifically match to the + // `shell` property _and_ the value, whereas the `step` rule matches + // to just the sequence item and not the property that follows it. + ...rule(language.rules.stepStartingWithShell, { + ...matchSequenceItem("shell", language.shellPattern), + + patterns: [ + // Match to a `run` property that contains either + // a block scalar, or a plain flow scalar. + {include: ref(language.rules.runBlock)}, + {include: ref(language.rules.runPlain)}, + + // Anything else can be handled by the workflow grammar. + SYNTAX.anyWorkflowSyntax + ] + }), + + // This rule matches to a step that does not start with a `shell` property. + // The step might define a `shell` property later, but if it doesn't, then + // it will use the default shell. This is different to the `step` rule + // by the patterns that are included. For this rule, we need to match t + // which matches to any step, regardless of what it starts with. + ...rule(language.rules.stepMaybeDefaultShell, { + // We don't care what the step starts with here + // because when this rule is included, it's always + // after the rule for steps that start with a `shell`. + ...matchSequenceItem(), + + patterns: [ + // Match to a `shell` property. If we match to this, + // then the step is overriding the default shell. + // We need one pattern for each language. + ...languages.map(language => ({include: ref(language.rules.stepShell)})), + + // Match to a `run` property that contains either + // a block scalar, or a plain flow scalar. If we match + // to these, then they will use the default shell. + {include: ref(language.rules.runBlock)}, + {include: ref(language.rules.runPlain)}, + + // Anything else can be handled by the workflow grammar. + SYNTAX.anyWorkflowSyntax + ] + }), + + // This rule matches the `shell` property in a step. + // This is used to override the default shell for a step, + // or to set the shell for a step when there is no default. + ...rule(language.rules.stepShell, { + ...matchPartialObjectProperty("shell", language.shellPattern), + + patterns: [ + // Match to a `run` property that contains either + // a block scalar, or a plain flow scalar. If we match + // to these, then they will use the default shell. + {include: ref(language.rules.runBlock)}, + {include: ref(language.rules.runPlain)}, + + // Anything else can be handled by the workflow grammar. + SYNTAX.anyWorkflowSyntax + ] + }), + + // This rule matches the `run` property when it + // is a block scalar and does not start a step. + [language.rules.runBlock]: blockRule( + "run", + `meta.embedded.inline.${language.name}`, + `source.${language.name}`, + false + ), + + // This rule matches the `run` property when + // it is a block scalar and does start a step. + [language.rules.stepStartingWithRunBlock]: blockRule( + "run", + `meta.embedded.inline.${language.name}`, + `source.${language.name}`, + true + ), + + // This rule matches the `script` property when it + // is a plain flow scalar and does not start a step. + [language.rules.runPlain]: plainRule( + "run", + `meta.embedded.inline.${language.name}`, + `source.${language.name}`, + false + ), + + // This rule matches the `script` property when it + // is a plain flow scalar and does start a step. + [language.rules.stepStartingWithRunPlain]: plainRule( + "run", + `meta.embedded.inline.${language.name}`, + `source.${language.name}`, + true + ) + })) + .reduce((previous, current) => Object.assign(previous, current), {}) + } + }; + + await writeGrammarFile(grammar, "run.tmGrammar.json"); +} + +/** + * + * @param {string} name The name of the language. + * @param {string[]} shells The shells that use the language. + * @returns {Language} The language definition. + */ +function defineLanguage(name, shells) { + return { + name, + shellPattern: shells.join("|"), + rules: { + workflowDefaultsRunShell: `defaults.run.shell.${name}`, + jobsDefaultShell: `jobs.default-shell.${name}`, + jobDefaultShell: `job.default-shell.${name}`, + jobDefaultsRunShell: `job.defaults.run.shell.${name}`, + stepsDefaultShell: `steps.default-shell.${name}`, + stepStartingWithShell: `step.starting-with-shell.${name}`, + stepMaybeDefaultShell: `step.maybe-default-shell.${name}`, + stepShell: `step.shell.${name}`, + runBlock: `run.block.${name}`, + stepStartingWithRunBlock: `step.run.block.${name}`, + runPlain: `run.plain.${name}`, + stepStartingWithRunPlain: `step.run.plain.${name}` + } + }; +} + +/** + * Creates a rule that matches a jobs property. + * @param {string} jobRuleName The name of the rule to include that matches each job property. + * @returns {Rule} The rule definition. + */ +function jobs(jobRuleName) { + return { + // The `jobs` property is at the + // top-level, so there will be no indent. + ...matchWholeObjectProperty("jobs", false), + + patterns: [ + // Match to the `job` property. This allows us + // to detect the default shell for the job. + {include: ref(jobRuleName)}, + + // Anything else can be handled by the workflow grammar. + SYNTAX.anyWorkflowSyntax + ] + }; +} + +/** + * Creates a rule that matches a job property. + * @param {string} stepsRuleName The name of the rule to include that matches the job's + * steps when the job does not define a default shell. + * @returns {Rule} The rule definition. + */ +function job(stepsRuleName) { + return { + // A job is a child of `jobs`. This rule is only matched within + // our `jobs` rule for a default shell, so the first indented line + // that is not a comment or sequence item will be the start of a job. + ...matchWholeObjectProperty(String.raw`(?![#-])\S+`, true), + + patterns: [ + // Match the `defaults` property. This allows + // us to set the default shell for the job. + {include: ref(RULE_NAMES.jobDefaults)}, + + // Match the `steps` property. This will continue to the end of the + // job. If we match this, then the job does not have a default shell. + {include: ref(stepsRuleName)}, + + // Anything else can be handled by the workflow grammar. + SYNTAX.anyWorkflowSyntax + ] + }; +} + +/** + * @typedef Language + * @property {string} name The name of the language. + * @property {string} shellPattern The regular expression that matches any of the shells. + * @property {LanguageRules} rules The names of rules for this language. + */ + +/** + * @typedef LanguageRules + * @property {string} workflowDefaultsRunShell The name of the rule that matches a workflow's default shell. + * @property {string} jobsDefaultShell The name of the rule that matches a workflow's `jobs` property when the workflow has a default shell. + * @property {string} jobDefaultShell The name of the rule that matches a job property when the workflow has a default shell. + * @property {string} jobDefaultsRunShell The name of the rule that matches a job's default shell. + * @property {string} stepsDefaultShell The name of the rule for the steps in a job that has a default shell. + * @property {string} stepStartingWithShell The name of the rule for a step that starts with a `shell` property. + * @property {string} stepMaybeDefaultShell The name of the rule for a step that does not start with a `shell` property. It may define a shell later. + * @property {string} stepShell The name of the rule for a `shell` property that is within a step, but does not start the step. + * @property {string} runBlock The name of the rule for a `run` property containing a block scalar. + * @property {string} stepStartingWithRunBlock The name of the rule for a step that starts with a `run` property containing a block scalar. + * @property {string} runPlain The name of the rule for a `run` property containing a plain string. + * @property {string} stepStartingWithRunPlain The name of the rule for a step that starts with a `run` property containing a plain string. + */ + +/** + * @typedef {import('./common.mjs').Rule} Rule + */ diff --git a/script/grammars/generate.mjs b/script/grammars/generate.mjs new file mode 100644 index 00000000..16a53d65 --- /dev/null +++ b/script/grammars/generate.mjs @@ -0,0 +1,14 @@ +/* eslint-env node */ + +// @ts-check + +import {generateRunGrammar} from "./generate-run.mjs"; +import {generateGitHubScriptGrammar} from "./generate-github-script.mjs"; + +(async () => { + await generateGitHubScriptGrammar(); + await generateRunGrammar(); +})().catch(ex => { + console.error(ex); + process.exit(1); +}); From e5fcfb7f7893dfe2489928efdf0e5107b278511c Mon Sep 17 00:00:00 2001 From: reduckted Date: Sun, 9 Aug 2026 20:14:01 +1000 Subject: [PATCH 3/9] Created a grammar for syntax highlighting the JavaScript in `actions/github-script` steps. --- .../actions-github-script.tmGrammar.json | 188 ++++++++++++++++++ package.json | 10 + 2 files changed, 198 insertions(+) create mode 100644 language/syntaxes/actions-github-script.tmGrammar.json diff --git a/language/syntaxes/actions-github-script.tmGrammar.json b/language/syntaxes/actions-github-script.tmGrammar.json new file mode 100644 index 00000000..9320633c --- /dev/null +++ b/language/syntaxes/actions-github-script.tmGrammar.json @@ -0,0 +1,188 @@ +{ + "information_for_contributors": [ + "This file has been generated by 'script/grammars/generate.mjs'.", + "Any changes should be made in that script, then use `npm run grammars-generate` to regenerate this file." + ], + "scopeName": "source.github-actions-workflow.actions-github-script", + "injectionSelector": "L:source.github-actions-workflow", + "patterns": [ + { + "include": "#actions-github-script.uses" + }, + { + "include": "#actions-github-script.uses-sequence-item" + } + ], + "repository": { + "actions-github-script.uses": { + "begin": "^([ ]+)(uses)[ ]*(:)[ ]+(actions/github-script@(?:\\S+))([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "name": "string.unquoted.plain.out.yaml" + }, + "5": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1|[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#actions-github-script.with" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "actions-github-script.uses-sequence-item": { + "begin": "^([ ]+)(-)([ ]+)(uses)[ ]*(:)[ ]+(actions\\/github-script@\\S+)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "punctuation.definition.block.sequence.item.yaml" + }, + "4": { + "name": "entity.name.tag.yaml" + }, + "5": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "6": { + "name": "string.unquoted.plain.out.yaml" + }, + "7": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 \\3|[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#actions-github-script.with" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "actions-github-script.with": { + "begin": "^([ ]+)(with)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#actions-github-script.script.block" + }, + { + "include": "#actions-github-script.script.plain" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "actions-github-script.script.block": { + "begin": "^([ ]+)(script)[ ]*(:)[ ]+(?:(\\|)|(>))([1-9])?([-+])?([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "5": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "6": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "7": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "8": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|[ ]*$)", + "name": "meta.embedded.inline.javascript", + "patterns": [ + { + "include": "source.js" + } + ] + } + ] + }, + "actions-github-script.script.plain": { + "begin": "^([ ]+)(script)[ ]*(:)[ ]+", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + } + }, + "end": "^(?!\\1 |[ ]*$)", + "name": "meta.embedded.inline.javascript", + "patterns": [ + { + "include": "source.js" + } + ] + } + } +} diff --git a/package.json b/package.json index 987e8720..735c6bba 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,16 @@ "injectTo": [ "source.github-actions-workflow" ] + }, + { + "scopeName": "source.github-actions-workflow.actions-script", + "path": "./language/syntaxes/actions-script.tmGrammar.json", + "injectTo": [ + "source.github-actions-workflow" + ], + "embeddedLanguages": { + "source.js": "javascript" + } } ], "configuration": { From af1d4cb841740a4ef8e756f497378d2bfaec4c6d Mon Sep 17 00:00:00 2001 From: reduckted Date: Sun, 9 Aug 2026 20:14:25 +1000 Subject: [PATCH 4/9] Created a grammar for syntax highlighting the scripts in `run` properties. --- language/syntaxes/run.tmGrammar.json | 2113 ++++++++++++++++++++++++++ package.json | 13 + script/grammars/generate-run.mjs | 26 +- 3 files changed, 2150 insertions(+), 2 deletions(-) create mode 100644 language/syntaxes/run.tmGrammar.json diff --git a/language/syntaxes/run.tmGrammar.json b/language/syntaxes/run.tmGrammar.json new file mode 100644 index 00000000..5356a783 --- /dev/null +++ b/language/syntaxes/run.tmGrammar.json @@ -0,0 +1,2113 @@ +{ + "information_for_contributors": [ + "This file has been generated by 'script/grammars/generate.mjs'.", + "Any changes should be made in that script, then use `npm run grammars-generate` to regenerate this file." + ], + "scopeName": "source.github-actions-workflow.run", + "injectionSelector": "L:source.github-actions-workflow", + "patterns": [ + { + "include": "#on" + }, + { + "include": "#runs" + } + ], + "repository": { + "on": { + "begin": "^(on)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "1": { + "name": "entity.name.tag.yaml" + }, + "2": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "3": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!.*)$", + "patterns": [ + { + "include": "#defaults" + }, + { + "include": "#jobs" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "runs": { + "begin": "^(runs)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "1": { + "name": "entity.name.tag.yaml" + }, + "2": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "3": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?! |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#steps.no-default-shell" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "defaults": { + "begin": "^(defaults)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "1": { + "name": "entity.name.tag.yaml" + }, + "2": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "3": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?! |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#defaults.run" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "defaults.run": { + "begin": "^([ ]+)(run)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#jobs" + }, + { + "include": "#defaults.run.shell.shell" + }, + { + "include": "#defaults.run.shell.batchfile" + }, + { + "include": "#defaults.run.shell.powershell" + }, + { + "include": "#defaults.run.shell.python" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "jobs": { + "begin": "^(jobs)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "1": { + "name": "entity.name.tag.yaml" + }, + "2": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "3": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?! |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#job" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "job": { + "begin": "^([ ]+)((?![#-])\\S+)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#job.defaults" + }, + { + "include": "#steps.no-default-shell" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "job.defaults": { + "begin": "^([ ]+)(defaults)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#job.defaults.run" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "job.defaults.run": { + "begin": "^([ ]+)(run)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#steps.no-default-shell" + }, + { + "include": "#job.defaults.run.shell.shell" + }, + { + "include": "#job.defaults.run.shell.batchfile" + }, + { + "include": "#job.defaults.run.shell.powershell" + }, + { + "include": "#job.defaults.run.shell.python" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "steps.no-default-shell": { + "begin": "^([ ]+)(steps)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#step.starting-with-shell.shell" + }, + { + "include": "#step.starting-with-shell.batchfile" + }, + { + "include": "#step.starting-with-shell.powershell" + }, + { + "include": "#step.starting-with-shell.python" + }, + { + "include": "#step.no-default-shell" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "step.no-default-shell": { + "begin": "^([ ]+)(-)([ ]+)", + "beginCaptures": { + "2": { + "name": "punctuation.definition.block.sequence.item.yaml" + } + }, + "end": "^(?!\\1 \\3|[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#step.shell.shell" + }, + { + "include": "#step.shell.batchfile" + }, + { + "include": "#step.shell.powershell" + }, + { + "include": "#step.shell.python" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "step.with": { + "begin": "^([ ]+)(with)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "source.github-actions-workflow" + } + ] + }, + "defaults.run.shell.shell": { + "begin": "^([ ]+)(shell)[ ]*(:)[ ]+(bash|sh)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "name": "string.unquoted.plain.out.yaml" + }, + "5": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!.*)$", + "patterns": [ + { + "include": "#jobs.default-shell.shell" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "jobs.default-shell.shell": { + "begin": "^(jobs)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "1": { + "name": "entity.name.tag.yaml" + }, + "2": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "3": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?! |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#job.default-shell.shell" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "job.default-shell.shell": { + "begin": "^([ ]+)((?![#-])\\S+)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#job.defaults" + }, + { + "include": "#steps.default-shell.shell" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "job.defaults.run.shell.shell": { + "begin": "^([ ]+)\\1{3}(shell)[ ]*(:)[ ]+(bash|sh)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "name": "string.unquoted.plain.out.yaml" + }, + "5": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#steps.default-shell.shell" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "steps.default-shell.shell": { + "begin": "^([ ]+)(steps)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#step.starting-with-shell.shell" + }, + { + "include": "#step.starting-with-shell.batchfile" + }, + { + "include": "#step.starting-with-shell.powershell" + }, + { + "include": "#step.starting-with-shell.python" + }, + { + "include": "#step.run.block.shell" + }, + { + "include": "#step.run.plain.shell" + }, + { + "include": "#step.maybe-default-shell.shell" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "step.starting-with-shell.shell": { + "begin": "^([ ]+)(-)([ ]+)(shell)[ ]*(:)[ ]+(bash|sh)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "punctuation.definition.block.sequence.item.yaml" + }, + "4": { + "name": "entity.name.tag.yaml" + }, + "5": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "6": { + "name": "string.unquoted.plain.out.yaml" + }, + "7": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 \\3|[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#run.block.shell" + }, + { + "include": "#run.plain.shell" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "step.maybe-default-shell.shell": { + "begin": "^([ ]+)(-)([ ]+)", + "beginCaptures": { + "2": { + "name": "punctuation.definition.block.sequence.item.yaml" + } + }, + "end": "^(?!\\1 \\3|[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#step.with" + }, + { + "include": "#step.shell.shell" + }, + { + "include": "#step.shell.batchfile" + }, + { + "include": "#step.shell.powershell" + }, + { + "include": "#step.shell.python" + }, + { + "include": "#run.block.shell" + }, + { + "include": "#run.plain.shell" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "step.shell.shell": { + "begin": "^([ ]+)(shell)[ ]*(:)[ ]+(bash|sh)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "name": "string.unquoted.plain.out.yaml" + }, + "5": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1|[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#run.block.shell" + }, + { + "include": "#run.plain.shell" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "run.block.shell": { + "begin": "^([ ]+)(run)[ ]*(:)[ ]+(?:(\\|)|(>))([1-9])?([-+])?([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "5": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "6": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "7": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "8": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|[ ]*$)", + "name": "meta.embedded.inline.shell", + "patterns": [ + { + "include": "source.shell" + } + ] + } + ] + }, + "step.run.block.shell": { + "begin": "^([ ]+)(-)([ ]+)(run)[ ]*(:)[ ]+(?:(\\|)|(>))([1-9])?([-+])?([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "punctuation.definition.block.sequence.item.yaml" + }, + "4": { + "name": "entity.name.tag.yaml" + }, + "5": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "6": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "7": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "8": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "9": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "10": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 \\3 |[ ]*$)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|[ ]*$)", + "name": "meta.embedded.inline.shell", + "patterns": [ + { + "include": "source.shell" + } + ] + } + ] + }, + "run.plain.shell": { + "begin": "^([ ]+)(run)[ ]*(:)[ ]+", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + } + }, + "end": "^(?!\\1 |[ ]*$)", + "name": "meta.embedded.inline.shell", + "patterns": [ + { + "include": "source.shell" + } + ] + }, + "step.run.plain.shell": { + "begin": "^([ ]+)(-)([ ]+)(run)[ ]*(:)[ ]+", + "beginCaptures": { + "2": { + "name": "punctuation.definition.block.sequence.item.yaml" + }, + "4": { + "name": "entity.name.tag.yaml" + }, + "5": { + "name": "punctuation.separator.key-value.mapping.yaml" + } + }, + "end": "^(?!\\1 \\3 |[ ]*$)", + "name": "meta.embedded.inline.shell", + "patterns": [ + { + "include": "source.shell" + } + ] + }, + "defaults.run.shell.batchfile": { + "begin": "^([ ]+)(shell)[ ]*(:)[ ]+(cmd)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "name": "string.unquoted.plain.out.yaml" + }, + "5": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!.*)$", + "patterns": [ + { + "include": "#jobs.default-shell.batchfile" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "jobs.default-shell.batchfile": { + "begin": "^(jobs)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "1": { + "name": "entity.name.tag.yaml" + }, + "2": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "3": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?! |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#job.default-shell.batchfile" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "job.default-shell.batchfile": { + "begin": "^([ ]+)((?![#-])\\S+)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#job.defaults" + }, + { + "include": "#steps.default-shell.batchfile" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "job.defaults.run.shell.batchfile": { + "begin": "^([ ]+)\\1{3}(shell)[ ]*(:)[ ]+(cmd)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "name": "string.unquoted.plain.out.yaml" + }, + "5": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#steps.default-shell.batchfile" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "steps.default-shell.batchfile": { + "begin": "^([ ]+)(steps)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#step.starting-with-shell.shell" + }, + { + "include": "#step.starting-with-shell.batchfile" + }, + { + "include": "#step.starting-with-shell.powershell" + }, + { + "include": "#step.starting-with-shell.python" + }, + { + "include": "#step.run.block.batchfile" + }, + { + "include": "#step.run.plain.batchfile" + }, + { + "include": "#step.maybe-default-shell.batchfile" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "step.starting-with-shell.batchfile": { + "begin": "^([ ]+)(-)([ ]+)(shell)[ ]*(:)[ ]+(cmd)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "punctuation.definition.block.sequence.item.yaml" + }, + "4": { + "name": "entity.name.tag.yaml" + }, + "5": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "6": { + "name": "string.unquoted.plain.out.yaml" + }, + "7": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 \\3|[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#run.block.batchfile" + }, + { + "include": "#run.plain.batchfile" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "step.maybe-default-shell.batchfile": { + "begin": "^([ ]+)(-)([ ]+)", + "beginCaptures": { + "2": { + "name": "punctuation.definition.block.sequence.item.yaml" + } + }, + "end": "^(?!\\1 \\3|[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#step.with" + }, + { + "include": "#step.shell.shell" + }, + { + "include": "#step.shell.batchfile" + }, + { + "include": "#step.shell.powershell" + }, + { + "include": "#step.shell.python" + }, + { + "include": "#run.block.batchfile" + }, + { + "include": "#run.plain.batchfile" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "step.shell.batchfile": { + "begin": "^([ ]+)(shell)[ ]*(:)[ ]+(cmd)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "name": "string.unquoted.plain.out.yaml" + }, + "5": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1|[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#run.block.batchfile" + }, + { + "include": "#run.plain.batchfile" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "run.block.batchfile": { + "begin": "^([ ]+)(run)[ ]*(:)[ ]+(?:(\\|)|(>))([1-9])?([-+])?([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "5": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "6": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "7": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "8": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|[ ]*$)", + "name": "meta.embedded.inline.batchfile", + "patterns": [ + { + "include": "source.batchfile" + } + ] + } + ] + }, + "step.run.block.batchfile": { + "begin": "^([ ]+)(-)([ ]+)(run)[ ]*(:)[ ]+(?:(\\|)|(>))([1-9])?([-+])?([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "punctuation.definition.block.sequence.item.yaml" + }, + "4": { + "name": "entity.name.tag.yaml" + }, + "5": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "6": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "7": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "8": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "9": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "10": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 \\3 |[ ]*$)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|[ ]*$)", + "name": "meta.embedded.inline.batchfile", + "patterns": [ + { + "include": "source.batchfile" + } + ] + } + ] + }, + "run.plain.batchfile": { + "begin": "^([ ]+)(run)[ ]*(:)[ ]+", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + } + }, + "end": "^(?!\\1 |[ ]*$)", + "name": "meta.embedded.inline.batchfile", + "patterns": [ + { + "include": "source.batchfile" + } + ] + }, + "step.run.plain.batchfile": { + "begin": "^([ ]+)(-)([ ]+)(run)[ ]*(:)[ ]+", + "beginCaptures": { + "2": { + "name": "punctuation.definition.block.sequence.item.yaml" + }, + "4": { + "name": "entity.name.tag.yaml" + }, + "5": { + "name": "punctuation.separator.key-value.mapping.yaml" + } + }, + "end": "^(?!\\1 \\3 |[ ]*$)", + "name": "meta.embedded.inline.batchfile", + "patterns": [ + { + "include": "source.batchfile" + } + ] + }, + "defaults.run.shell.powershell": { + "begin": "^([ ]+)(shell)[ ]*(:)[ ]+(pwsh|powershell)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "name": "string.unquoted.plain.out.yaml" + }, + "5": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!.*)$", + "patterns": [ + { + "include": "#jobs.default-shell.powershell" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "jobs.default-shell.powershell": { + "begin": "^(jobs)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "1": { + "name": "entity.name.tag.yaml" + }, + "2": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "3": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?! |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#job.default-shell.powershell" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "job.default-shell.powershell": { + "begin": "^([ ]+)((?![#-])\\S+)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#job.defaults" + }, + { + "include": "#steps.default-shell.powershell" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "job.defaults.run.shell.powershell": { + "begin": "^([ ]+)\\1{3}(shell)[ ]*(:)[ ]+(pwsh|powershell)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "name": "string.unquoted.plain.out.yaml" + }, + "5": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#steps.default-shell.powershell" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "steps.default-shell.powershell": { + "begin": "^([ ]+)(steps)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#step.starting-with-shell.shell" + }, + { + "include": "#step.starting-with-shell.batchfile" + }, + { + "include": "#step.starting-with-shell.powershell" + }, + { + "include": "#step.starting-with-shell.python" + }, + { + "include": "#step.run.block.powershell" + }, + { + "include": "#step.run.plain.powershell" + }, + { + "include": "#step.maybe-default-shell.powershell" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "step.starting-with-shell.powershell": { + "begin": "^([ ]+)(-)([ ]+)(shell)[ ]*(:)[ ]+(pwsh|powershell)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "punctuation.definition.block.sequence.item.yaml" + }, + "4": { + "name": "entity.name.tag.yaml" + }, + "5": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "6": { + "name": "string.unquoted.plain.out.yaml" + }, + "7": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 \\3|[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#run.block.powershell" + }, + { + "include": "#run.plain.powershell" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "step.maybe-default-shell.powershell": { + "begin": "^([ ]+)(-)([ ]+)", + "beginCaptures": { + "2": { + "name": "punctuation.definition.block.sequence.item.yaml" + } + }, + "end": "^(?!\\1 \\3|[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#step.with" + }, + { + "include": "#step.shell.shell" + }, + { + "include": "#step.shell.batchfile" + }, + { + "include": "#step.shell.powershell" + }, + { + "include": "#step.shell.python" + }, + { + "include": "#run.block.powershell" + }, + { + "include": "#run.plain.powershell" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "step.shell.powershell": { + "begin": "^([ ]+)(shell)[ ]*(:)[ ]+(pwsh|powershell)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "name": "string.unquoted.plain.out.yaml" + }, + "5": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1|[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#run.block.powershell" + }, + { + "include": "#run.plain.powershell" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "run.block.powershell": { + "begin": "^([ ]+)(run)[ ]*(:)[ ]+(?:(\\|)|(>))([1-9])?([-+])?([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "5": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "6": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "7": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "8": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|[ ]*$)", + "name": "meta.embedded.inline.powershell", + "patterns": [ + { + "include": "source.powershell" + } + ] + } + ] + }, + "step.run.block.powershell": { + "begin": "^([ ]+)(-)([ ]+)(run)[ ]*(:)[ ]+(?:(\\|)|(>))([1-9])?([-+])?([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "punctuation.definition.block.sequence.item.yaml" + }, + "4": { + "name": "entity.name.tag.yaml" + }, + "5": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "6": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "7": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "8": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "9": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "10": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 \\3 |[ ]*$)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|[ ]*$)", + "name": "meta.embedded.inline.powershell", + "patterns": [ + { + "include": "source.powershell" + } + ] + } + ] + }, + "run.plain.powershell": { + "begin": "^([ ]+)(run)[ ]*(:)[ ]+", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + } + }, + "end": "^(?!\\1 |[ ]*$)", + "name": "meta.embedded.inline.powershell", + "patterns": [ + { + "include": "source.powershell" + } + ] + }, + "step.run.plain.powershell": { + "begin": "^([ ]+)(-)([ ]+)(run)[ ]*(:)[ ]+", + "beginCaptures": { + "2": { + "name": "punctuation.definition.block.sequence.item.yaml" + }, + "4": { + "name": "entity.name.tag.yaml" + }, + "5": { + "name": "punctuation.separator.key-value.mapping.yaml" + } + }, + "end": "^(?!\\1 \\3 |[ ]*$)", + "name": "meta.embedded.inline.powershell", + "patterns": [ + { + "include": "source.powershell" + } + ] + }, + "defaults.run.shell.python": { + "begin": "^([ ]+)(shell)[ ]*(:)[ ]+(python)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "name": "string.unquoted.plain.out.yaml" + }, + "5": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!.*)$", + "patterns": [ + { + "include": "#jobs.default-shell.python" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "jobs.default-shell.python": { + "begin": "^(jobs)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "1": { + "name": "entity.name.tag.yaml" + }, + "2": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "3": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?! |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#job.default-shell.python" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "job.default-shell.python": { + "begin": "^([ ]+)((?![#-])\\S+)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#job.defaults" + }, + { + "include": "#steps.default-shell.python" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "job.defaults.run.shell.python": { + "begin": "^([ ]+)\\1{3}(shell)[ ]*(:)[ ]+(python)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "name": "string.unquoted.plain.out.yaml" + }, + "5": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#steps.default-shell.python" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "steps.default-shell.python": { + "begin": "^([ ]+)(steps)[ ]*(:)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#step.starting-with-shell.shell" + }, + { + "include": "#step.starting-with-shell.batchfile" + }, + { + "include": "#step.starting-with-shell.powershell" + }, + { + "include": "#step.starting-with-shell.python" + }, + { + "include": "#step.run.block.python" + }, + { + "include": "#step.run.plain.python" + }, + { + "include": "#step.maybe-default-shell.python" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "step.starting-with-shell.python": { + "begin": "^([ ]+)(-)([ ]+)(shell)[ ]*(:)[ ]+(python)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "punctuation.definition.block.sequence.item.yaml" + }, + "4": { + "name": "entity.name.tag.yaml" + }, + "5": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "6": { + "name": "string.unquoted.plain.out.yaml" + }, + "7": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 \\3|[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#run.block.python" + }, + { + "include": "#run.plain.python" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "step.maybe-default-shell.python": { + "begin": "^([ ]+)(-)([ ]+)", + "beginCaptures": { + "2": { + "name": "punctuation.definition.block.sequence.item.yaml" + } + }, + "end": "^(?!\\1 \\3|[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#step.with" + }, + { + "include": "#step.shell.shell" + }, + { + "include": "#step.shell.batchfile" + }, + { + "include": "#step.shell.powershell" + }, + { + "include": "#step.shell.python" + }, + { + "include": "#run.block.python" + }, + { + "include": "#run.plain.python" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "step.shell.python": { + "begin": "^([ ]+)(shell)[ ]*(:)[ ]+(python)([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "name": "string.unquoted.plain.out.yaml" + }, + "5": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1|[ ]*$|[ ]*#.*$)", + "patterns": [ + { + "include": "#run.block.python" + }, + { + "include": "#run.plain.python" + }, + { + "include": "source.github-actions-workflow" + } + ] + }, + "run.block.python": { + "begin": "^([ ]+)(run)[ ]*(:)[ ]+(?:(\\|)|(>))([1-9])?([-+])?([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "4": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "5": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "6": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "7": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "8": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 |[ ]*$)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|[ ]*$)", + "name": "meta.embedded.inline.python", + "patterns": [ + { + "include": "source.python" + } + ] + } + ] + }, + "step.run.block.python": { + "begin": "^([ ]+)(-)([ ]+)(run)[ ]*(:)[ ]+(?:(\\|)|(>))([1-9])?([-+])?([ ]+.*)?$", + "beginCaptures": { + "2": { + "name": "punctuation.definition.block.sequence.item.yaml" + }, + "4": { + "name": "entity.name.tag.yaml" + }, + "5": { + "name": "punctuation.separator.key-value.mapping.yaml" + }, + "6": { + "name": "keyword.control.flow.block-scalar.literal.yaml" + }, + "7": { + "name": "keyword.control.flow.block-scalar.folded.yaml" + }, + "8": { + "name": "constant.numeric.indentation-indicator.yaml" + }, + "9": { + "name": "storage.modifier.chomping-indicator.yaml" + }, + "10": { + "patterns": [ + { + "include": "source.github-actions-workflow#comment" + }, + { + "match": ".+", + "name": "invalid.illegal.expected-comment-or-newline.yaml" + } + ] + } + }, + "end": "^(?!\\1 \\3 |[ ]*$)", + "patterns": [ + { + "begin": "^([ ]+)(?! )", + "end": "^(?!\\1|[ ]*$)", + "name": "meta.embedded.inline.python", + "patterns": [ + { + "include": "source.python" + } + ] + } + ] + }, + "run.plain.python": { + "begin": "^([ ]+)(run)[ ]*(:)[ ]+", + "beginCaptures": { + "2": { + "name": "entity.name.tag.yaml" + }, + "3": { + "name": "punctuation.separator.key-value.mapping.yaml" + } + }, + "end": "^(?!\\1 |[ ]*$)", + "name": "meta.embedded.inline.python", + "patterns": [ + { + "include": "source.python" + } + ] + }, + "step.run.plain.python": { + "begin": "^([ ]+)(-)([ ]+)(run)[ ]*(:)[ ]+", + "beginCaptures": { + "2": { + "name": "punctuation.definition.block.sequence.item.yaml" + }, + "4": { + "name": "entity.name.tag.yaml" + }, + "5": { + "name": "punctuation.separator.key-value.mapping.yaml" + } + }, + "end": "^(?!\\1 \\3 |[ ]*$)", + "name": "meta.embedded.inline.python", + "patterns": [ + { + "include": "source.python" + } + ] + } + } +} diff --git a/package.json b/package.json index 735c6bba..99d7915e 100644 --- a/package.json +++ b/package.json @@ -73,6 +73,19 @@ "embeddedLanguages": { "source.js": "javascript" } + }, + { + "scopeName": "source.github-actions-workflow.run", + "path": "./language/syntaxes/run.tmGrammar.json", + "injectTo": [ + "source.github-actions-workflow" + ], + "embeddedLanguages": { + "source.batchfile": "bat", + "source.powershell": "powershell", + "source.python": "python", + "source.shell": "shellscript" + } } ], "configuration": { diff --git a/script/grammars/generate-run.mjs b/script/grammars/generate-run.mjs index a5790e77..e105e13c 100644 --- a/script/grammars/generate-run.mjs +++ b/script/grammars/generate-run.mjs @@ -31,7 +31,8 @@ const RULE_NAMES = { jobDefaults: "job.defaults", jobDefaultsRun: "job.defaults.run", stepsNoDefaultShell: "steps.no-default-shell", - step: "step.no-default-shell" + step: "step.no-default-shell", + stepWith: "step.with" }; const MATCH_NOTHING = "^(?!.*)$"; @@ -214,7 +215,23 @@ export async function generateRunGrammar() { // us to set the shell for everything that follows it in the step. ...languages.map(language => ({include: ref(language.rules.stepShell)})), - // Anything else can be handled by the workflow grammar. + // Anything else can be handled by the workflow grammar. + SYNTAX.anyWorkflowSyntax + ] + }), + + // Define a rule that matches to a `with` property in a step. This is used + // to skip over the inputs for an action so that if there's an input + // called `run`, it won't get interpreted as the step's `run` property. + ...rule(RULE_NAMES.stepWith, { + // Match to a sequence item. This rule is only used + // within the `steps` property, so we can guarantee + // that any sequence item we match to is a step. + ...matchWholeObjectProperty("with", true), + + patterns: [ + // Let everything be handled by the workflow grammar + // so that we don't match an input called `run`. SYNTAX.anyWorkflowSyntax ] }), @@ -350,6 +367,11 @@ export async function generateRunGrammar() { ...matchSequenceItem(), patterns: [ + // Match to a `with` property. We match to this first so that an + // input in the `with` block called "run" doesn't cause the value of + // that input to have the syntax highlighting from the default shell. + {include: ref(RULE_NAMES.stepWith)}, + // Match to a `shell` property. If we match to this, // then the step is overriding the default shell. // We need one pattern for each language. From 1c71e326308bf60f9547a62644907e9fa7c6a7c2 Mon Sep 17 00:00:00 2001 From: reduckted Date: Sun, 9 Aug 2026 20:36:29 +1000 Subject: [PATCH 5/9] Added tests for the expression grammar. --- .github/workflows/build.yml | 1 + .prettierignore | 3 +- .vscodeignore | 3 +- jest.config.js | 5 +- .../test/expressions/expression-all.test.yml | 13 + .../expressions/expression-all.test.yml.snap | 82 + .../expressions/expression-boolean.test.yml | 13 + .../expression-boolean.test.yml.snap | 69 + .../expressions/expression-context.test.yml | 13 + .../expression-context.test.yml.snap | 69 + .../expressions/expression-function.test.yml | 14 + .../expression-function.test.yml.snap | 80 + .../test/expressions/expression-null.test.yml | 13 + .../expressions/expression-null.test.yml.snap | 69 + .../expressions/expression-number.test.yml | 13 + .../expression-number.test.yml.snap | 69 + .../expressions/expression-string.test.yml | 13 + .../expression-string.test.yml.snap | 73 + .../syntaxes/test/expressions/if-all.test.yml | 14 + .../test/expressions/if-all.test.yml.snap | 86 + .../test/expressions/if-boolean.test.yml | 14 + .../test/expressions/if-boolean.test.yml.snap | 73 + .../test/expressions/if-context.test.yml | 14 + .../test/expressions/if-context.test.yml.snap | 77 + .../test/expressions/if-expression.test.yml | 14 + .../expressions/if-expression.test.yml.snap | 89 + .../test/expressions/if-function.test.yml | 14 + .../expressions/if-function.test.yml.snap | 80 + .../test/expressions/if-null.test.yml | 14 + .../test/expressions/if-null.test.yml.snap | 73 + .../test/expressions/if-number.test.yml | 14 + .../test/expressions/if-number.test.yml.snap | 73 + .../test/expressions/if-string.test.yml | 14 + .../test/expressions/if-string.test.yml.snap | 77 + .../JavaScript.tmLanguage.json | 6001 +++++++++++++++++ .../MagicPython.tmLanguage.json | 4213 ++++++++++++ .../batchfile.tmLanguage.json | 788 +++ .../powershell.tmLanguage.json | 1029 +++ .../syntaxes/test/injected-grammars/readme.md | 3 + .../shell-unix-bash.tmLanguage.json | 2353 +++++++ package-lock.json | 255 +- package.json | 11 +- 42 files changed, 16000 insertions(+), 8 deletions(-) create mode 100644 language/syntaxes/test/expressions/expression-all.test.yml create mode 100644 language/syntaxes/test/expressions/expression-all.test.yml.snap create mode 100644 language/syntaxes/test/expressions/expression-boolean.test.yml create mode 100644 language/syntaxes/test/expressions/expression-boolean.test.yml.snap create mode 100644 language/syntaxes/test/expressions/expression-context.test.yml create mode 100644 language/syntaxes/test/expressions/expression-context.test.yml.snap create mode 100644 language/syntaxes/test/expressions/expression-function.test.yml create mode 100644 language/syntaxes/test/expressions/expression-function.test.yml.snap create mode 100644 language/syntaxes/test/expressions/expression-null.test.yml create mode 100644 language/syntaxes/test/expressions/expression-null.test.yml.snap create mode 100644 language/syntaxes/test/expressions/expression-number.test.yml create mode 100644 language/syntaxes/test/expressions/expression-number.test.yml.snap create mode 100644 language/syntaxes/test/expressions/expression-string.test.yml create mode 100644 language/syntaxes/test/expressions/expression-string.test.yml.snap create mode 100644 language/syntaxes/test/expressions/if-all.test.yml create mode 100644 language/syntaxes/test/expressions/if-all.test.yml.snap create mode 100644 language/syntaxes/test/expressions/if-boolean.test.yml create mode 100644 language/syntaxes/test/expressions/if-boolean.test.yml.snap create mode 100644 language/syntaxes/test/expressions/if-context.test.yml create mode 100644 language/syntaxes/test/expressions/if-context.test.yml.snap create mode 100644 language/syntaxes/test/expressions/if-expression.test.yml create mode 100644 language/syntaxes/test/expressions/if-expression.test.yml.snap create mode 100644 language/syntaxes/test/expressions/if-function.test.yml create mode 100644 language/syntaxes/test/expressions/if-function.test.yml.snap create mode 100644 language/syntaxes/test/expressions/if-null.test.yml create mode 100644 language/syntaxes/test/expressions/if-null.test.yml.snap create mode 100644 language/syntaxes/test/expressions/if-number.test.yml create mode 100644 language/syntaxes/test/expressions/if-number.test.yml.snap create mode 100644 language/syntaxes/test/expressions/if-string.test.yml create mode 100644 language/syntaxes/test/expressions/if-string.test.yml.snap create mode 100644 language/syntaxes/test/injected-grammars/JavaScript.tmLanguage.json create mode 100644 language/syntaxes/test/injected-grammars/MagicPython.tmLanguage.json create mode 100644 language/syntaxes/test/injected-grammars/batchfile.tmLanguage.json create mode 100644 language/syntaxes/test/injected-grammars/powershell.tmLanguage.json create mode 100644 language/syntaxes/test/injected-grammars/readme.md create mode 100644 language/syntaxes/test/injected-grammars/shell-unix-bash.tmLanguage.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 93cc2e03..831fec23 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,3 +27,4 @@ jobs: - run: npm run lint - run: npm run build - run: npm run test + - run: npm run grammars-test diff --git a/.prettierignore b/.prettierignore index bdc418d2..54f8cfdd 100644 --- a/.prettierignore +++ b/.prettierignore @@ -5,4 +5,5 @@ dist .DS_Store runners .yalc -*.md \ No newline at end of file +*.md +language/syntaxes/test/**/* \ No newline at end of file diff --git a/.vscodeignore b/.vscodeignore index 8ab44df9..8bf10f05 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -6,4 +6,5 @@ src/ tsconfig.json webpack.config.js media -dist/*.map \ No newline at end of file +dist/*.map +language/syntaxes/test/ \ No newline at end of file diff --git a/jest.config.js b/jest.config.js index 679a18e0..fe32444a 100755 --- a/jest.config.js +++ b/jest.config.js @@ -12,5 +12,8 @@ module.exports = { } ] }, - moduleFileExtensions: ["ts", "js"] + moduleFileExtensions: ["ts", "js"], + // Exclude the language tests so that Jest doesn't think + // that the snapshot files belong to Jest and are obsolete. + testPathIgnorePatterns: ["^/language/"] }; diff --git a/language/syntaxes/test/expressions/expression-all.test.yml b/language/syntaxes/test/expressions/expression-all.test.yml new file mode 100644 index 00000000..82b6acd2 --- /dev/null +++ b/language/syntaxes/test/expressions/expression-all.test.yml @@ -0,0 +1,13 @@ +# SYNTAX TEST "source.github-actions-workflow" "all values types in expression" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: ${{ success() || 'foo bar' == github.ref_name || 42 != true || null }} + uses: foo/bar@main diff --git a/language/syntaxes/test/expressions/expression-all.test.yml.snap b/language/syntaxes/test/expressions/expression-all.test.yml.snap new file mode 100644 index 00000000..e7107188 --- /dev/null +++ b/language/syntaxes/test/expressions/expression-all.test.yml.snap @@ -0,0 +1,82 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "all values types in expression" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: ${{ success() || 'foo bar' == github.ref_name || 42 != true || null }} +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^^^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression support.function.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression string.quoted.single.github-actions-expression +# ^^^^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression string.quoted.single.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression string.quoted.single.github-actions-expression +# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^^^^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^ source.github-actions-workflow meta.embedded.block.github-actions-expression constant.numeric.github-actions-expression +# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +> uses: foo/bar@main +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/expressions/expression-boolean.test.yml b/language/syntaxes/test/expressions/expression-boolean.test.yml new file mode 100644 index 00000000..d0263f4b --- /dev/null +++ b/language/syntaxes/test/expressions/expression-boolean.test.yml @@ -0,0 +1,13 @@ +# SYNTAX TEST "source.github-actions-workflow" "boolean in an expression" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: ${{ true == false }} + uses: foo/bar@main diff --git a/language/syntaxes/test/expressions/expression-boolean.test.yml.snap b/language/syntaxes/test/expressions/expression-boolean.test.yml.snap new file mode 100644 index 00000000..02f3e0e4 --- /dev/null +++ b/language/syntaxes/test/expressions/expression-boolean.test.yml.snap @@ -0,0 +1,69 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "boolean in an expression" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: ${{ true == false }} +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +> uses: foo/bar@main +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/expressions/expression-context.test.yml b/language/syntaxes/test/expressions/expression-context.test.yml new file mode 100644 index 00000000..12554cff --- /dev/null +++ b/language/syntaxes/test/expressions/expression-context.test.yml @@ -0,0 +1,13 @@ +# SYNTAX TEST "source.github-actions-workflow" "context access in an expression" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: ${{ github.ref_name }} + uses: foo/bar@main diff --git a/language/syntaxes/test/expressions/expression-context.test.yml.snap b/language/syntaxes/test/expressions/expression-context.test.yml.snap new file mode 100644 index 00000000..55828588 --- /dev/null +++ b/language/syntaxes/test/expressions/expression-context.test.yml.snap @@ -0,0 +1,69 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "context access in an expression" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: ${{ github.ref_name }} +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^^^^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +> uses: foo/bar@main +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/expressions/expression-function.test.yml b/language/syntaxes/test/expressions/expression-function.test.yml new file mode 100644 index 00000000..9e3ca756 --- /dev/null +++ b/language/syntaxes/test/expressions/expression-function.test.yml @@ -0,0 +1,14 @@ +# SYNTAX TEST "source.github-actions-workflow" "function call in an expression" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Step + if: startsWith('test/', github.ref_name) + uses: foo/bar@main diff --git a/language/syntaxes/test/expressions/expression-function.test.yml.snap b/language/syntaxes/test/expressions/expression-function.test.yml.snap new file mode 100644 index 00000000..d02ea6cf --- /dev/null +++ b/language/syntaxes/test/expressions/expression-function.test.yml.snap @@ -0,0 +1,80 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "function call in an expression" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> if: startsWith('test/', github.ref_name) +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^ source.github-actions-workflow support.function.github-actions-expression +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.quoted.single.github-actions-expression +# ^^^^^ source.github-actions-workflow string.quoted.single.github-actions-expression +# ^ source.github-actions-workflow string.quoted.single.github-actions-expression +# ^^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +# ^ source.github-actions-workflow +# ^^^^^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +# ^ source.github-actions-workflow +> uses: foo/bar@main +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/expressions/expression-null.test.yml b/language/syntaxes/test/expressions/expression-null.test.yml new file mode 100644 index 00000000..401603d1 --- /dev/null +++ b/language/syntaxes/test/expressions/expression-null.test.yml @@ -0,0 +1,13 @@ +# SYNTAX TEST "source.github-actions-workflow" "null in expression" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: ${{ null == null }} + uses: foo/bar@main diff --git a/language/syntaxes/test/expressions/expression-null.test.yml.snap b/language/syntaxes/test/expressions/expression-null.test.yml.snap new file mode 100644 index 00000000..5054a8a8 --- /dev/null +++ b/language/syntaxes/test/expressions/expression-null.test.yml.snap @@ -0,0 +1,69 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "null in expression" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: ${{ null == null }} +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +> uses: foo/bar@main +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/expressions/expression-number.test.yml b/language/syntaxes/test/expressions/expression-number.test.yml new file mode 100644 index 00000000..d5da3b04 --- /dev/null +++ b/language/syntaxes/test/expressions/expression-number.test.yml @@ -0,0 +1,13 @@ +# SYNTAX TEST "source.github-actions-workflow" "number in expression" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: ${{ 1 == -2.3 }} + uses: foo/bar@main diff --git a/language/syntaxes/test/expressions/expression-number.test.yml.snap b/language/syntaxes/test/expressions/expression-number.test.yml.snap new file mode 100644 index 00000000..d7b8c84e --- /dev/null +++ b/language/syntaxes/test/expressions/expression-number.test.yml.snap @@ -0,0 +1,69 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "number in expression" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: ${{ 1 == -2.3 }} +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression constant.numeric.github-actions-expression +# ^^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression constant.numeric.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +> uses: foo/bar@main +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/expressions/expression-string.test.yml b/language/syntaxes/test/expressions/expression-string.test.yml new file mode 100644 index 00000000..8411a01e --- /dev/null +++ b/language/syntaxes/test/expressions/expression-string.test.yml @@ -0,0 +1,13 @@ +# SYNTAX TEST "source.github-actions-workflow" "string in expression" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: ${{ 'foo bar' == 'bar foo' }} + uses: foo/bar@main diff --git a/language/syntaxes/test/expressions/expression-string.test.yml.snap b/language/syntaxes/test/expressions/expression-string.test.yml.snap new file mode 100644 index 00000000..3ebd87b1 --- /dev/null +++ b/language/syntaxes/test/expressions/expression-string.test.yml.snap @@ -0,0 +1,73 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "string in expression" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: ${{ 'foo bar' == 'bar foo' }} +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression string.quoted.single.github-actions-expression +# ^^^^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression string.quoted.single.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression string.quoted.single.github-actions-expression +# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression string.quoted.single.github-actions-expression +# ^^^^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression string.quoted.single.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression string.quoted.single.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +> uses: foo/bar@main +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/expressions/if-all.test.yml b/language/syntaxes/test/expressions/if-all.test.yml new file mode 100644 index 00000000..bac27407 --- /dev/null +++ b/language/syntaxes/test/expressions/if-all.test.yml @@ -0,0 +1,14 @@ +# SYNTAX TEST "source.github-actions-workflow" "all values types in `if` property" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Step + if: success() || 'foo bar' == github.ref_name || 42 != true || null + uses: foo/bar@main diff --git a/language/syntaxes/test/expressions/if-all.test.yml.snap b/language/syntaxes/test/expressions/if-all.test.yml.snap new file mode 100644 index 00000000..d9110e57 --- /dev/null +++ b/language/syntaxes/test/expressions/if-all.test.yml.snap @@ -0,0 +1,86 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "all values types in `if` property" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> if: success() || 'foo bar' == github.ref_name || 42 != true || null +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^ source.github-actions-workflow support.function.github-actions-expression +# ^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.quoted.single.github-actions-expression +# ^^^^^^^ source.github-actions-workflow string.quoted.single.github-actions-expression +# ^ source.github-actions-workflow string.quoted.single.github-actions-expression +# ^^^^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +# ^ source.github-actions-workflow +# ^^^^^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +# ^^^^ source.github-actions-workflow +# ^^ source.github-actions-workflow constant.numeric.github-actions-expression +# ^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +# ^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +> uses: foo/bar@main +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/expressions/if-boolean.test.yml b/language/syntaxes/test/expressions/if-boolean.test.yml new file mode 100644 index 00000000..25cc6583 --- /dev/null +++ b/language/syntaxes/test/expressions/if-boolean.test.yml @@ -0,0 +1,14 @@ +# SYNTAX TEST "source.github-actions-workflow" "boolean in `if` property" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Step + if: true == false + uses: foo/bar@main diff --git a/language/syntaxes/test/expressions/if-boolean.test.yml.snap b/language/syntaxes/test/expressions/if-boolean.test.yml.snap new file mode 100644 index 00000000..d48d5442 --- /dev/null +++ b/language/syntaxes/test/expressions/if-boolean.test.yml.snap @@ -0,0 +1,73 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "boolean in `if` property" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> if: true == false +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +# ^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +> uses: foo/bar@main +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/expressions/if-context.test.yml b/language/syntaxes/test/expressions/if-context.test.yml new file mode 100644 index 00000000..7e27da0b --- /dev/null +++ b/language/syntaxes/test/expressions/if-context.test.yml @@ -0,0 +1,14 @@ +# SYNTAX TEST "source.github-actions-workflow" "context access in `if` property" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Step + if: github.ref_name == github.ref_name + uses: foo/bar@main diff --git a/language/syntaxes/test/expressions/if-context.test.yml.snap b/language/syntaxes/test/expressions/if-context.test.yml.snap new file mode 100644 index 00000000..974cc16c --- /dev/null +++ b/language/syntaxes/test/expressions/if-context.test.yml.snap @@ -0,0 +1,77 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "context access in `if` property" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> if: github.ref_name == github.ref_name +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +# ^ source.github-actions-workflow +# ^^^^^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +# ^^^^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +# ^ source.github-actions-workflow +# ^^^^^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +> uses: foo/bar@main +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/expressions/if-expression.test.yml b/language/syntaxes/test/expressions/if-expression.test.yml new file mode 100644 index 00000000..95d06b8d --- /dev/null +++ b/language/syntaxes/test/expressions/if-expression.test.yml @@ -0,0 +1,14 @@ +# SYNTAX TEST "source.github-actions-workflow" "${{ expression }} in `if` property" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Step + if: ${{ !startsWith('test/', github.ref_name) }} + uses: foo/bar@main diff --git a/language/syntaxes/test/expressions/if-expression.test.yml.snap b/language/syntaxes/test/expressions/if-expression.test.yml.snap new file mode 100644 index 00000000..33d97c38 --- /dev/null +++ b/language/syntaxes/test/expressions/if-expression.test.yml.snap @@ -0,0 +1,89 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "${{ expression }} in `if` property" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +# ^^^ source.github-actions-workflow comment.line.number-sign.yaml meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow comment.line.number-sign.yaml meta.embedded.block.github-actions-expression +# ^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^ source.github-actions-workflow comment.line.number-sign.yaml meta.embedded.block.github-actions-expression +# ^^ source.github-actions-workflow comment.line.number-sign.yaml meta.embedded.block.github-actions-expression +# ^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> if: ${{ !startsWith('test/', github.ref_name) }} +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression support.function.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression string.quoted.single.github-actions-expression +# ^^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression string.quoted.single.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression string.quoted.single.github-actions-expression +# ^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^^^^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +# ^^ source.github-actions-workflow meta.embedded.block.github-actions-expression +> uses: foo/bar@main +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/expressions/if-function.test.yml b/language/syntaxes/test/expressions/if-function.test.yml new file mode 100644 index 00000000..ae8d8381 --- /dev/null +++ b/language/syntaxes/test/expressions/if-function.test.yml @@ -0,0 +1,14 @@ +# SYNTAX TEST "source.github-actions-workflow" "function call in `if` property" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Step + if: startsWith('test/', github.ref_name) + uses: foo/bar@main diff --git a/language/syntaxes/test/expressions/if-function.test.yml.snap b/language/syntaxes/test/expressions/if-function.test.yml.snap new file mode 100644 index 00000000..c5a86a74 --- /dev/null +++ b/language/syntaxes/test/expressions/if-function.test.yml.snap @@ -0,0 +1,80 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "function call in `if` property" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> if: startsWith('test/', github.ref_name) +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^ source.github-actions-workflow support.function.github-actions-expression +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.quoted.single.github-actions-expression +# ^^^^^ source.github-actions-workflow string.quoted.single.github-actions-expression +# ^ source.github-actions-workflow string.quoted.single.github-actions-expression +# ^^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +# ^ source.github-actions-workflow +# ^^^^^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +# ^ source.github-actions-workflow +> uses: foo/bar@main +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/expressions/if-null.test.yml b/language/syntaxes/test/expressions/if-null.test.yml new file mode 100644 index 00000000..44cbf32e --- /dev/null +++ b/language/syntaxes/test/expressions/if-null.test.yml @@ -0,0 +1,14 @@ +# SYNTAX TEST "source.github-actions-workflow" "null in `if` property" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Step + if: null == null + uses: foo/bar@main diff --git a/language/syntaxes/test/expressions/if-null.test.yml.snap b/language/syntaxes/test/expressions/if-null.test.yml.snap new file mode 100644 index 00000000..429e68e2 --- /dev/null +++ b/language/syntaxes/test/expressions/if-null.test.yml.snap @@ -0,0 +1,73 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "null in `if` property" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> if: null == null +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +# ^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +> uses: foo/bar@main +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/expressions/if-number.test.yml b/language/syntaxes/test/expressions/if-number.test.yml new file mode 100644 index 00000000..f6da2c37 --- /dev/null +++ b/language/syntaxes/test/expressions/if-number.test.yml @@ -0,0 +1,14 @@ +# SYNTAX TEST "source.github-actions-workflow" "number in `if` property" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Step + if: 1 == -2.3 + uses: foo/bar@main diff --git a/language/syntaxes/test/expressions/if-number.test.yml.snap b/language/syntaxes/test/expressions/if-number.test.yml.snap new file mode 100644 index 00000000..336c6450 --- /dev/null +++ b/language/syntaxes/test/expressions/if-number.test.yml.snap @@ -0,0 +1,73 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "number in `if` property" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> if: 1 == -2.3 +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow constant.numeric.github-actions-expression +# ^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow constant.numeric.github-actions-expression +> uses: foo/bar@main +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/expressions/if-string.test.yml b/language/syntaxes/test/expressions/if-string.test.yml new file mode 100644 index 00000000..e3b82fde --- /dev/null +++ b/language/syntaxes/test/expressions/if-string.test.yml @@ -0,0 +1,14 @@ +# SYNTAX TEST "source.github-actions-workflow" "string in `if` property" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Step + if: 'foo bar' == 'bar foo' + uses: foo/bar@main diff --git a/language/syntaxes/test/expressions/if-string.test.yml.snap b/language/syntaxes/test/expressions/if-string.test.yml.snap new file mode 100644 index 00000000..202dc286 --- /dev/null +++ b/language/syntaxes/test/expressions/if-string.test.yml.snap @@ -0,0 +1,77 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "string in `if` property" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> if: 'foo bar' == 'bar foo' +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.quoted.single.github-actions-expression +# ^^^^^^^ source.github-actions-workflow string.quoted.single.github-actions-expression +# ^ source.github-actions-workflow string.quoted.single.github-actions-expression +# ^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.quoted.single.github-actions-expression +# ^^^^^^^ source.github-actions-workflow string.quoted.single.github-actions-expression +# ^ source.github-actions-workflow string.quoted.single.github-actions-expression +> uses: foo/bar@main +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/injected-grammars/JavaScript.tmLanguage.json b/language/syntaxes/test/injected-grammars/JavaScript.tmLanguage.json new file mode 100644 index 00000000..fea5d190 --- /dev/null +++ b/language/syntaxes/test/injected-grammars/JavaScript.tmLanguage.json @@ -0,0 +1,6001 @@ +{ + "information_for_contributors": [ + "This file has been converted from https://github.com/microsoft/TypeScript-TmLanguage/blob/master/TypeScriptReact.tmLanguage", + "If you want to provide a fix or improvement, please create a pull request against the original repository.", + "Once accepted there, we are happy to receive an update request." + ], + "version": "https://github.com/microsoft/TypeScript-TmLanguage/commit/48f608692aa6d6ad7bd65b478187906c798234a8", + "name": "JavaScript (with React support)", + "scopeName": "source.js", + "patterns": [ + { + "include": "#directives" + }, + { + "include": "#statements" + }, + { + "include": "#shebang" + } + ], + "repository": { + "shebang": { + "name": "comment.line.shebang.js", + "match": "\\A(#!).*(?=$)", + "captures": { + "1": { + "name": "punctuation.definition.comment.js" + } + } + }, + "statements": { + "patterns": [ + { + "include": "#declaration" + }, + { + "include": "#control-statement" + }, + { + "include": "#after-operator-block-as-object-literal" + }, + { + "include": "#decl-block" + }, + { + "include": "#label" + }, + { + "include": "#expression" + }, + { + "include": "#punctuation-semicolon" + }, + { + "include": "#string" + }, + { + "include": "#comment" + } + ] + }, + "declaration": { + "patterns": [ + { + "include": "#decorator" + }, + { + "include": "#var-expr" + }, + { + "include": "#function-declaration" + }, + { + "include": "#class-declaration" + }, + { + "include": "#interface-declaration" + }, + { + "include": "#enum-declaration" + }, + { + "include": "#namespace-declaration" + }, + { + "include": "#type-alias-declaration" + }, + { + "include": "#import-equals-declaration" + }, + { + "include": "#import-declaration" + }, + { + "include": "#export-declaration" + }, + { + "name": "storage.modifier.js", + "match": "(?)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()\\'\\\"\\`]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)) |\n# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>\n(:\\s*(\n (<) |\n ([(]\\s*(\n ([)]) |\n (\\.\\.\\.) |\n ([_$[:alnum:]]+\\s*(\n ([:,?=])|\n ([)]\\s*=>)\n ))\n ))\n)) |\n(:\\s*(?\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*))))))) |\n(:\\s*(=>|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(<[^<>]*>)|[^<>(),=])+=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()\\'\\\"\\`]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)))", + "beginCaptures": { + "1": { + "name": "meta.definition.variable.js entity.name.function.js" + }, + "2": { + "name": "keyword.operator.definiteassignment.js" + } + }, + "end": "(?=$|^|[;,=}]|((?)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()\\'\\\"\\`]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)) |\n# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>\n(:\\s*(\n (<) |\n ([(]\\s*(\n ([)]) |\n (\\.\\.\\.) |\n ([_$[:alnum:]]+\\s*(\n ([:,?=])|\n ([)]\\s*=>)\n ))\n ))\n)) |\n(:\\s*(?\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*))))))) |\n(:\\s*(=>|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(<[^<>]*>)|[^<>(),=])+=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()\\'\\\"\\`]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)))", + "beginCaptures": { + "1": { + "name": "meta.definition.variable.js variable.other.constant.js entity.name.function.js" + } + }, + "end": "(?=$|^|[;,=}]|((?)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()\\'\\\"\\`]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)) |\n# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>\n(:\\s*(\n (<) |\n ([(]\\s*(\n ([)]) |\n (\\.\\.\\.) |\n ([_$[:alnum:]]+\\s*(\n ([:,?=])|\n ([)]\\s*=>)\n ))\n ))\n)) |\n(:\\s*(?\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*))))))) |\n(:\\s*(=>|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(<[^<>]*>)|[^<>(),=])+=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()\\'\\\"\\`]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)))", + "captures": { + "1": { + "name": "storage.modifier.js" + }, + "2": { + "name": "keyword.operator.rest.js" + }, + "3": { + "name": "entity.name.function.js variable.language.this.js" + }, + "4": { + "name": "entity.name.function.js" + }, + "5": { + "name": "keyword.operator.optional.js" + } + } + }, + { + "match": "(?x)(?:(?)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()\\'\\\"\\`]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)) |\n# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>\n(:\\s*(\n (<) |\n ([(]\\s*(\n ([)]) |\n (\\.\\.\\.) |\n ([_$[:alnum:]]+\\s*(\n ([:,?=])|\n ([)]\\s*=>)\n ))\n ))\n)) |\n(:\\s*(?\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*))))))) |\n(:\\s*(=>|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(<[^<>]*>)|[^<>(),=])+=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()\\'\\\"\\`]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)))", + "captures": { + "1": { + "name": "meta.definition.property.js entity.name.function.js" + }, + "2": { + "name": "keyword.operator.optional.js" + }, + "3": { + "name": "keyword.operator.definiteassignment.js" + } + } + }, + { + "name": "meta.definition.property.js variable.object.property.js", + "match": "\\#?[_$[:alpha:]][_$[:alnum:]]*" + }, + { + "name": "keyword.operator.optional.js", + "match": "\\?" + }, + { + "name": "keyword.operator.definiteassignment.js", + "match": "\\!" + } + ] + }, + "variable-initializer": { + "patterns": [ + { + "begin": "(?\\s*$)", + "beginCaptures": { + "1": { + "name": "keyword.operator.assignment.js" + } + }, + "end": "(?=$|^|[,);}\\]]|((?]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*))?[\\(])", + "beginCaptures": { + "1": { + "name": "storage.modifier.js" + }, + "2": { + "name": "storage.modifier.js" + }, + "3": { + "name": "storage.modifier.js" + }, + "4": { + "name": "storage.modifier.async.js" + }, + "5": { + "name": "keyword.operator.new.js" + }, + "6": { + "name": "keyword.generator.asterisk.js" + } + }, + "end": "(?=\\}|;|,|$)|(?<=\\})", + "patterns": [ + { + "include": "#method-declaration-name" + }, + { + "include": "#function-body" + } + ] + }, + { + "name": "meta.method.declaration.js", + "begin": "(?x)(?]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*))?[\\(])", + "beginCaptures": { + "1": { + "name": "storage.modifier.js" + }, + "2": { + "name": "storage.modifier.js" + }, + "3": { + "name": "storage.modifier.js" + }, + "4": { + "name": "storage.modifier.async.js" + }, + "5": { + "name": "storage.type.property.js" + }, + "6": { + "name": "keyword.generator.asterisk.js" + } + }, + "end": "(?=\\}|;|,|$)|(?<=\\})", + "patterns": [ + { + "include": "#method-declaration-name" + }, + { + "include": "#function-body" + } + ] + } + ] + }, + "object-literal-method-declaration": { + "name": "meta.method.declaration.js", + "begin": "(?x)(?]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*))?[\\(])", + "beginCaptures": { + "1": { + "name": "storage.modifier.async.js" + }, + "2": { + "name": "storage.type.property.js" + }, + "3": { + "name": "keyword.generator.asterisk.js" + } + }, + "end": "(?=\\}|;|,)|(?<=\\})", + "patterns": [ + { + "include": "#method-declaration-name" + }, + { + "include": "#function-body" + }, + { + "begin": "(?x)(?]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*))?[\\(])", + "beginCaptures": { + "1": { + "name": "storage.modifier.async.js" + }, + "2": { + "name": "storage.type.property.js" + }, + "3": { + "name": "keyword.generator.asterisk.js" + } + }, + "end": "(?=\\(|\\<)", + "patterns": [ + { + "include": "#method-declaration-name" + } + ] + } + ] + }, + "method-declaration-name": { + "begin": "(?x)(?=((\\b(?)", + "captures": { + "1": { + "name": "storage.modifier.async.js" + }, + "2": { + "name": "variable.parameter.js" + } + } + }, + { + "name": "meta.arrow.js", + "begin": "(?x) (?:\n (? is on new line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()\\'\\\"\\`]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n )\n)", + "beginCaptures": { + "1": { + "name": "storage.modifier.async.js" + } + }, + "end": "(?==>|\\{|(^\\s*(export|function|class|interface|let|var|(?:\\busing(?=\\s+(?!in\\b|of\\b(?!\\s*(?:of\\b|=)))[_$[:alpha:]])\\b)|(?:\\bawait\\s+(?:\\busing(?=\\s+(?!in\\b|of\\b(?!\\s*(?:of\\b|=)))[_$[:alpha:]])\\b)\\b)|const|import|enum|namespace|module|type|abstract|declare)\\s+))", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#type-parameters" + }, + { + "include": "#function-parameters" + }, + { + "include": "#arrow-return-type" + }, + { + "include": "#possibly-arrow-return-type" + } + ] + }, + { + "name": "meta.arrow.js", + "begin": "=>", + "beginCaptures": { + "0": { + "name": "storage.type.function.arrow.js" + } + }, + "end": "((?<=\\}|\\S)(?)|((?!\\{)(?=\\S)))(?!\\/[\\/\\*])", + "patterns": [ + { + "include": "#single-line-comment-consuming-line-ending" + }, + { + "include": "#decl-block" + }, + { + "include": "#expression" + } + ] + } + ] + }, + "indexer-declaration": { + "name": "meta.indexer.declaration.js", + "begin": "(?:(?]|^await|[^\\._$[:alnum:]]await|^return|[^\\._$[:alnum:]]return|^yield|[^\\._$[:alnum:]]yield|^throw|[^\\._$[:alnum:]]throw|^in|[^\\._$[:alnum:]]in|^of|[^\\._$[:alnum:]]of|^typeof|[^\\._$[:alnum:]]typeof|&&|\\|\\||\\*)\\s*(\\{)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.block.js" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.definition.block.js" + } + }, + "patterns": [ + { + "include": "#object-member" + } + ] + }, + "object-literal": { + "name": "meta.objectliteral.js", + "begin": "\\{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.block.js" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.definition.block.js" + } + }, + "patterns": [ + { + "include": "#object-member" + } + ] + }, + "object-member": { + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#object-literal-method-declaration" + }, + { + "name": "meta.object.member.js meta.object-literal.key.js", + "begin": "(?=\\[)", + "end": "(?=:)|((?<=[\\]])(?=\\s*[\\(\\<]))", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#array-literal" + } + ] + }, + { + "name": "meta.object.member.js meta.object-literal.key.js", + "begin": "(?=[\\'\\\"\\`])", + "end": "(?=:)|((?<=[\\'\\\"\\`])(?=((\\s*[\\(\\<,}])|(\\s+(as|satisifies)\\s+))))", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#string" + } + ] + }, + { + "name": "meta.object.member.js meta.object-literal.key.js", + "begin": "(?x)(?=(\\b(?)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()\\'\\\"\\`]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)))", + "captures": { + "0": { + "name": "meta.object-literal.key.js" + }, + "1": { + "name": "entity.name.function.js" + } + } + }, + { + "name": "meta.object.member.js", + "match": "(?:[_$[:alpha:]][_$[:alnum:]]*)\\s*(?=(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*:)", + "captures": { + "0": { + "name": "meta.object-literal.key.js" + } + } + }, + { + "name": "meta.object.member.js", + "begin": "\\.\\.\\.", + "beginCaptures": { + "0": { + "name": "keyword.operator.spread.js" + } + }, + "end": "(?=,|\\})", + "patterns": [ + { + "include": "#expression" + } + ] + }, + { + "name": "meta.object.member.js", + "match": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(?=,|\\}|$|\\/\\/|\\/\\*)", + "captures": { + "1": { + "name": "variable.other.readwrite.js" + } + } + }, + { + "name": "meta.object.member.js", + "match": "(?]|\\|\\||\\&\\&|\\!\\=\\=|$|^|((?]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)\\(\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))", + "beginCaptures": { + "1": { + "name": "storage.modifier.async.js" + } + }, + "end": "(?<=\\))", + "patterns": [ + { + "include": "#type-parameters" + }, + { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "meta.brace.round.js" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "meta.brace.round.js" + } + }, + "patterns": [ + { + "include": "#expression-inside-possibly-arrow-parens" + } + ] + } + ] + }, + { + "begin": "(?<=:)\\s*(async)?\\s*(\\()(?=\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))", + "beginCaptures": { + "1": { + "name": "storage.modifier.async.js" + }, + "2": { + "name": "meta.brace.round.js" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "meta.brace.round.js" + } + }, + "patterns": [ + { + "include": "#expression-inside-possibly-arrow-parens" + } + ] + }, + { + "begin": "(?<=:)\\s*(async)?\\s*(?=\\<\\s*$)", + "beginCaptures": { + "1": { + "name": "storage.modifier.async.js" + } + }, + "end": "(?<=\\>)", + "patterns": [ + { + "include": "#type-parameters" + } + ] + }, + { + "begin": "(?<=\\>)\\s*(\\()(?=\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))", + "beginCaptures": { + "1": { + "name": "meta.brace.round.js" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "meta.brace.round.js" + } + }, + "patterns": [ + { + "include": "#expression-inside-possibly-arrow-parens" + } + ] + }, + { + "include": "#possibly-arrow-return-type" + }, + { + "include": "#expression" + } + ] + }, + { + "include": "#punctuation-comma" + }, + { + "include": "#decl-block" + } + ] + }, + "ternary-expression": { + "begin": "(?!\\?\\.\\s*[^[:digit:]])(\\?)(?!\\?)", + "beginCaptures": { + "1": { + "name": "keyword.operator.ternary.js" + } + }, + "end": "\\s*(:)", + "endCaptures": { + "1": { + "name": "keyword.operator.ternary.js" + } + }, + "patterns": [ + { + "include": "#expression" + } + ] + }, + "function-call": { + "patterns": [ + { + "begin": "(?=(((([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))\\s*(?:(\\?\\.\\s*)|(\\!))?((<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\())", + "end": "(?<=\\))(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))\\s*(?:(\\?\\.\\s*)|(\\!))?((<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\())", + "patterns": [ + { + "name": "meta.function-call.js", + "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*))", + "end": "(?=\\s*(?:(\\?\\.\\s*)|(\\!))?((<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?\\())", + "patterns": [ + { + "include": "#function-call-target" + } + ] + }, + { + "include": "#comment" + }, + { + "include": "#function-call-optionals" + }, + { + "include": "#type-arguments" + }, + { + "include": "#paren-expression" + } + ] + }, + { + "begin": "(?=(((([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))(<\\s*[\\{\\[\\(]\\s*$))", + "end": "(?<=\\>)(?!(((([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*))|(?<=[\\)]))(<\\s*[\\{\\[\\(]\\s*$))", + "patterns": [ + { + "name": "meta.function-call.js", + "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*)(\\s*\\??\\.\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*))*)|(\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*))", + "end": "(?=(<\\s*[\\{\\[\\(]\\s*$))", + "patterns": [ + { + "include": "#function-call-target" + } + ] + }, + { + "include": "#comment" + }, + { + "include": "#function-call-optionals" + }, + { + "include": "#type-arguments" + } + ] + } + ] + }, + "function-call-target": { + "patterns": [ + { + "include": "#support-function-call-identifiers" + }, + { + "name": "entity.name.function.js", + "match": "(\\#?[_$[:alpha:]][_$[:alnum:]]*)" + } + ] + }, + "function-call-optionals": { + "patterns": [ + { + "name": "meta.function-call.js punctuation.accessor.optional.js", + "match": "\\?\\." + }, + { + "name": "meta.function-call.js keyword.operator.definiteassignment.js", + "match": "\\!" + } + ] + }, + "support-function-call-identifiers": { + "patterns": [ + { + "include": "#literal" + }, + { + "include": "#support-objects" + }, + { + "include": "#object-identifiers" + }, + { + "include": "#punctuation-accessor" + }, + { + "name": "keyword.operator.expression.import.js", + "match": "(?:(?]|\\|\\||\\&\\&|\\!\\=\\=|$|((?]|\\|\\||\\&\\&|\\!\\=\\=|$|(===|!==|==|!=)|(([\\&\\~\\^\\|]\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s+instanceof(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.)))|((?]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*))?\\(\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))", + "beginCaptures": { + "1": { + "name": "storage.modifier.async.js" + } + }, + "end": "(?<=\\))", + "patterns": [ + { + "include": "#paren-expression-possibly-arrow-with-typeparameters" + } + ] + }, + { + "begin": "(?<=[(=,]|=>|^return|[^\\._$[:alnum:]]return)\\s*(async)?(?=\\s*((((<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*))?\\()|(<)|((<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)))\\s*$)", + "beginCaptures": { + "1": { + "name": "storage.modifier.async.js" + } + }, + "end": "(?<=\\))", + "patterns": [ + { + "include": "#paren-expression-possibly-arrow-with-typeparameters" + } + ] + }, + { + "include": "#possibly-arrow-return-type" + } + ] + }, + "paren-expression-possibly-arrow-with-typeparameters": { + "patterns": [ + { + "include": "#type-parameters" + }, + { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "meta.brace.round.js" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "meta.brace.round.js" + } + }, + "patterns": [ + { + "include": "#expression-inside-possibly-arrow-parens" + } + ] + } + ] + }, + "expression-inside-possibly-arrow-parens": { + "patterns": [ + { + "include": "#expressionWithoutIdentifiers" + }, + { + "include": "#comment" + }, + { + "include": "#string" + }, + { + "include": "#decorator" + }, + { + "include": "#destructuring-parameter" + }, + { + "match": "(?)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()\\'\\\"\\`]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)) |\n# typeannotation is fn type: < | () | (... | (param: | (param, | (param? | (param= | (param) =>\n(:\\s*(\n (<) |\n ([(]\\s*(\n ([)]) |\n (\\.\\.\\.) |\n ([_$[:alnum:]]+\\s*(\n ([:,?=])|\n ([)]\\s*=>)\n ))\n ))\n)) |\n(:\\s*(?\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*))))))) |\n(:\\s*(=>|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(<[^<>]*>)|[^<>(),=])+=\\s*(\n ((async\\s+)?(\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()\\'\\\"\\`]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)))", + "captures": { + "1": { + "name": "storage.modifier.js" + }, + "2": { + "name": "keyword.operator.rest.js" + }, + "3": { + "name": "entity.name.function.js variable.language.this.js" + }, + "4": { + "name": "entity.name.function.js" + }, + "5": { + "name": "keyword.operator.optional.js" + } + } + }, + { + "match": "(?x)(?:(?]|\\|\\||\\&\\&|\\!\\=\\=|$|((?>=|>>>=|\\|=" + }, + { + "name": "keyword.operator.bitwise.shift.js", + "match": "<<|>>>|>>" + }, + { + "name": "keyword.operator.comparison.js", + "match": "===|!==|==|!=" + }, + { + "name": "keyword.operator.relational.js", + "match": "<=|>=|<>|<|>" + }, + { + "match": "(?<=[_$[:alnum:]])(\\!)\\s*(?:(/=)|(?:(/)(?![/*])))", + "captures": { + "1": { + "name": "keyword.operator.logical.js" + }, + "2": { + "name": "keyword.operator.assignment.compound.js" + }, + "3": { + "name": "keyword.operator.arithmetic.js" + } + } + }, + { + "name": "keyword.operator.logical.js", + "match": "\\!|&&|\\|\\||\\?\\?" + }, + { + "name": "keyword.operator.bitwise.js", + "match": "\\&|~|\\^|\\|" + }, + { + "name": "keyword.operator.assignment.js", + "match": "\\=" + }, + { + "name": "keyword.operator.decrement.js", + "match": "--" + }, + { + "name": "keyword.operator.increment.js", + "match": "\\+\\+" + }, + { + "name": "keyword.operator.arithmetic.js", + "match": "%|\\*|/|-|\\+" + }, + { + "begin": "(?<=[_$[:alnum:])\\]])\\s*(?=(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)+(?:(/=)|(?:(/)(?![/*]))))", + "end": "(?:(/=)|(?:(/)(?!\\*([^\\*]|(\\*[^\\/]))*\\*\\/)))", + "endCaptures": { + "1": { + "name": "keyword.operator.assignment.compound.js" + }, + "2": { + "name": "keyword.operator.arithmetic.js" + } + }, + "patterns": [ + { + "include": "#comment" + } + ] + }, + { + "match": "(?<=[_$[:alnum:])\\]])\\s*(?:(/=)|(?:(/)(?![/*])))", + "captures": { + "1": { + "name": "keyword.operator.assignment.compound.js" + }, + "2": { + "name": "keyword.operator.arithmetic.js" + } + } + } + ] + }, + "typeof-operator": { + "begin": "(?:&|{\\?]|(extends\\s+)|$|;|^\\s*$|(?:^\\s*(?:abstract|async|(?:\\bawait\\s+(?:\\busing(?=\\s+(?!in\\b|of\\b(?!\\s*(?:of\\b|=)))[_$[:alpha:]])\\b)\\b)|break|case|catch|class|const|continue|declare|do|else|enum|export|finally|function|for|goto|if|import|interface|let|module|namespace|switch|return|throw|try|type|(?:\\busing(?=\\s+(?!in\\b|of\\b(?!\\s*(?:of\\b|=)))[_$[:alpha:]])\\b)|var|while)\\b))", + "patterns": [ + { + "include": "#type-arguments" + }, + { + "include": "#expression" + } + ] + }, + "literal": { + "patterns": [ + { + "include": "#numeric-literal" + }, + { + "include": "#boolean-literal" + }, + { + "include": "#null-literal" + }, + { + "include": "#undefined-literal" + }, + { + "include": "#numericConstant-literal" + }, + { + "include": "#array-literal" + }, + { + "include": "#this-literal" + }, + { + "include": "#super-literal" + } + ] + }, + "array-literal": { + "name": "meta.array.literal.js", + "begin": "\\s*(\\[)", + "beginCaptures": { + "1": { + "name": "meta.brace.square.js" + } + }, + "end": "\\]", + "endCaptures": { + "0": { + "name": "meta.brace.square.js" + } + }, + "patterns": [ + { + "include": "#expression" + }, + { + "include": "#punctuation-comma" + } + ] + }, + "numeric-literal": { + "patterns": [ + { + "name": "constant.numeric.hex.js", + "match": "\\b(?]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\\())\n |\n (?:(EPSILON|MAX_SAFE_INTEGER|MAX_VALUE|MIN_SAFE_INTEGER|MIN_VALUE|NEGATIVE_INFINITY|POSITIVE_INFINITY)\\b(?!\\$)))", + "captures": { + "1": { + "name": "punctuation.accessor.js" + }, + "2": { + "name": "punctuation.accessor.optional.js" + }, + "3": { + "name": "support.variable.property.js" + }, + "4": { + "name": "support.constant.js" + } + } + }, + { + "match": "(?)\n )) |\n ((async\\s*)?(\n ((<\\s*$)|([\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n(\n [<]\\s*[_$[:alpha:]][_$[:alnum:]]*\\s+extends\\s*[^=>] # < typeparam extends\n) |\n# arrow function possible to detect only with => on same line\n(\n (<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*(((const\\s+)?[_$[:alpha:]])|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()\\'\\\"\\`]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n))", + "captures": { + "1": { + "name": "punctuation.accessor.js" + }, + "2": { + "name": "punctuation.accessor.optional.js" + }, + "3": { + "name": "entity.name.function.js" + } + } + }, + { + "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(\\#?[[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])", + "captures": { + "1": { + "name": "punctuation.accessor.js" + }, + "2": { + "name": "punctuation.accessor.optional.js" + }, + "3": { + "name": "variable.other.constant.property.js" + } + } + }, + { + "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*)", + "captures": { + "1": { + "name": "punctuation.accessor.js" + }, + "2": { + "name": "punctuation.accessor.optional.js" + }, + "3": { + "name": "variable.other.property.js" + } + } + }, + { + "name": "variable.other.constant.js", + "match": "([[:upper:]][_$[:digit:][:upper:]]*)(?![_$[:alnum:]])" + }, + { + "name": "variable.other.readwrite.js", + "match": "[_$[:alpha:]][_$[:alnum:]]*" + } + ] + }, + "object-identifiers": { + "patterns": [ + { + "name": "support.class.js", + "match": "([_$[:alpha:]][_$[:alnum:]]*)(?=\\s*\\??\\.\\s*prototype\\b(?!\\$))" + }, + { + "match": "(?x)(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(?:\n (\\#?[[:upper:]][_$[:digit:][:upper:]]*) |\n (\\#?[_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*)", + "captures": { + "1": { + "name": "punctuation.accessor.js" + }, + "2": { + "name": "punctuation.accessor.optional.js" + }, + "3": { + "name": "variable.other.constant.object.property.js" + }, + "4": { + "name": "variable.other.object.property.js" + } + } + }, + { + "match": "(?x)(?:\n ([[:upper:]][_$[:digit:][:upper:]]*) |\n ([_$[:alpha:]][_$[:alnum:]]*)\n)(?=\\s*\\??\\.\\s*\\#?[_$[:alpha:]][_$[:alnum:]]*)", + "captures": { + "1": { + "name": "variable.other.constant.object.js" + }, + "2": { + "name": "variable.other.object.js" + } + } + } + ] + }, + "type-annotation": { + "patterns": [ + { + "name": "meta.type.annotation.js", + "begin": "(:)(?=\\s*\\S)", + "beginCaptures": { + "1": { + "name": "keyword.operator.type.annotation.js" + } + }, + "end": "(?])|((?<=[\\}>\\]\\)]|[_$[:alpha:]])\\s*(?=\\{)))", + "patterns": [ + { + "include": "#type" + } + ] + }, + { + "name": "meta.type.annotation.js", + "begin": "(:)", + "beginCaptures": { + "1": { + "name": "keyword.operator.type.annotation.js" + } + }, + "end": "(?])|(?=^\\s*$)|((?<=[\\}>\\]\\)]|[_$[:alpha:]])\\s*(?=\\{)))", + "patterns": [ + { + "include": "#type" + } + ] + } + ] + }, + "parameter-type-annotation": { + "patterns": [ + { + "name": "meta.type.annotation.js", + "begin": "(:)", + "beginCaptures": { + "1": { + "name": "keyword.operator.type.annotation.js" + } + }, + "end": "(?=[,)])|(?==[^>])", + "patterns": [ + { + "include": "#type" + } + ] + } + ] + }, + "return-type": { + "patterns": [ + { + "name": "meta.return.type.js", + "begin": "(?<=\\))\\s*(:)(?=\\s*\\S)", + "beginCaptures": { + "1": { + "name": "keyword.operator.type.annotation.js" + } + }, + "end": "(?|\\{|(^\\s*(export|function|class|interface|let|var|(?:\\busing(?=\\s+(?!in\\b|of\\b(?!\\s*(?:of\\b|=)))[_$[:alpha:]])\\b)|(?:\\bawait\\s+(?:\\busing(?=\\s+(?!in\\b|of\\b(?!\\s*(?:of\\b|=)))[_$[:alpha:]])\\b)\\b)|const|import|enum|namespace|module|type|abstract|declare)\\s+))", + "patterns": [ + { + "include": "#arrow-return-type-body" + } + ] + }, + "possibly-arrow-return-type": { + "begin": "(?<=\\)|^)\\s*(:)(?=\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*=>)", + "beginCaptures": { + "1": { + "name": "meta.arrow.js meta.return.type.arrow.js keyword.operator.type.annotation.js" + } + }, + "end": "(?==>|\\{|(^\\s*(export|function|class|interface|let|var|(?:\\busing(?=\\s+(?!in\\b|of\\b(?!\\s*(?:of\\b|=)))[_$[:alpha:]])\\b)|(?:\\bawait\\s+(?:\\busing(?=\\s+(?!in\\b|of\\b(?!\\s*(?:of\\b|=)))[_$[:alpha:]])\\b)\\b)|const|import|enum|namespace|module|type|abstract|declare)\\s+))", + "contentName": "meta.arrow.js meta.return.type.arrow.js", + "patterns": [ + { + "include": "#arrow-return-type-body" + } + ] + }, + "arrow-return-type-body": { + "patterns": [ + { + "begin": "(?<=[:])(?=\\s*\\{)", + "end": "(?<=\\})", + "patterns": [ + { + "include": "#type-object" + } + ] + }, + { + "include": "#type-predicate-operator" + }, + { + "include": "#type" + } + ] + }, + "type-parameters": { + "name": "meta.type.parameters.js", + "begin": "(<)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.typeparameters.begin.js" + } + }, + "end": "(>)", + "endCaptures": { + "1": { + "name": "punctuation.definition.typeparameters.end.js" + } + }, + "patterns": [ + { + "include": "#comment" + }, + { + "name": "storage.modifier.js", + "match": "(?)" + } + ] + }, + "type-arguments": { + "name": "meta.type.parameters.js", + "begin": "\\<", + "beginCaptures": { + "0": { + "name": "punctuation.definition.typeparameters.begin.js" + } + }, + "end": "\\>", + "endCaptures": { + "0": { + "name": "punctuation.definition.typeparameters.end.js" + } + }, + "patterns": [ + { + "include": "#type-arguments-body" + } + ] + }, + "type-arguments-body": { + "patterns": [ + { + "match": "(?)\n ))\n ))\n)) |\n(:\\s*(?\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*))))))))", + "captures": { + "1": { + "name": "storage.modifier.js" + }, + "2": { + "name": "keyword.operator.rest.js" + }, + "3": { + "name": "entity.name.function.js variable.language.this.js" + }, + "4": { + "name": "entity.name.function.js" + }, + "5": { + "name": "keyword.operator.optional.js" + } + } + }, + { + "match": "(?x)(?:(?)", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#type-parameters" + } + ] + }, + { + "name": "meta.type.constructor.js", + "begin": "(?)\n ))\n )\n )\n)", + "end": "(?<=\\))", + "patterns": [ + { + "include": "#function-parameters" + } + ] + } + ] + }, + "type-function-return-type": { + "patterns": [ + { + "name": "meta.type.function.return.js", + "begin": "(=>)(?=\\s*\\S)", + "beginCaptures": { + "1": { + "name": "storage.type.function.arrow.js" + } + }, + "end": "(?)(?:\\?]|//|$)", + "patterns": [ + { + "include": "#type-function-return-type-core" + } + ] + }, + { + "name": "meta.type.function.return.js", + "begin": "=>", + "beginCaptures": { + "0": { + "name": "storage.type.function.arrow.js" + } + }, + "end": "(?)(?]|//|^\\s*$)|((?<=\\S)(?=\\s*$)))", + "patterns": [ + { + "include": "#type-function-return-type-core" + } + ] + } + ] + }, + "type-function-return-type-core": { + "patterns": [ + { + "include": "#comment" + }, + { + "begin": "(?<==>)(?=\\s*\\{)", + "end": "(?<=\\})", + "patterns": [ + { + "include": "#type-object" + } + ] + }, + { + "include": "#type-predicate-operator" + }, + { + "include": "#type" + } + ] + }, + "type-operators": { + "patterns": [ + { + "include": "#typeof-operator" + }, + { + "include": "#type-infer" + }, + { + "begin": "([&|])(?=\\s*\\{)", + "beginCaptures": { + "0": { + "name": "keyword.operator.type.js" + } + }, + "end": "(?<=\\})", + "patterns": [ + { + "include": "#type-object" + } + ] + }, + { + "begin": "[&|]", + "beginCaptures": { + "0": { + "name": "keyword.operator.type.js" + } + }, + "end": "(?=\\S)" + }, + { + "name": "keyword.operator.expression.keyof.js", + "match": "(?)", + "endCaptures": { + "1": { + "name": "meta.type.parameters.js punctuation.definition.typeparameters.end.js" + } + }, + "contentName": "meta.type.parameters.js", + "patterns": [ + { + "include": "#type-arguments-body" + } + ] + }, + { + "begin": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(<)", + "beginCaptures": { + "1": { + "name": "entity.name.type.js" + }, + "2": { + "name": "meta.type.parameters.js punctuation.definition.typeparameters.begin.js" + } + }, + "end": "(>)", + "endCaptures": { + "1": { + "name": "meta.type.parameters.js punctuation.definition.typeparameters.end.js" + } + }, + "contentName": "meta.type.parameters.js", + "patterns": [ + { + "include": "#type-arguments-body" + } + ] + }, + { + "match": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))", + "captures": { + "1": { + "name": "entity.name.type.module.js" + }, + "2": { + "name": "punctuation.accessor.js" + }, + "3": { + "name": "punctuation.accessor.optional.js" + } + } + }, + { + "name": "entity.name.type.js", + "match": "[_$[:alpha:]][_$[:alnum:]]*" + } + ] + }, + "punctuation-comma": { + "name": "punctuation.separator.comma.js", + "match": "," + }, + "punctuation-semicolon": { + "name": "punctuation.terminator.statement.js", + "match": ";" + }, + "punctuation-accessor": { + "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))", + "captures": { + "1": { + "name": "punctuation.accessor.js" + }, + "2": { + "name": "punctuation.accessor.optional.js" + } + } + }, + "string": { + "patterns": [ + { + "include": "#qstring-single" + }, + { + "include": "#qstring-double" + }, + { + "include": "#template" + } + ] + }, + "qstring-double": { + "name": "string.quoted.double.js", + "begin": "\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.js" + } + }, + "end": "(\")|((?:[^\\\\\\n])$)", + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.js" + }, + "2": { + "name": "invalid.illegal.newline.js" + } + }, + "patterns": [ + { + "include": "#string-character-escape" + } + ] + }, + "qstring-single": { + "name": "string.quoted.single.js", + "begin": "'", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.js" + } + }, + "end": "(\\')|((?:[^\\\\\\n])$)", + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.js" + }, + "2": { + "name": "invalid.illegal.newline.js" + } + }, + "patterns": [ + { + "include": "#string-character-escape" + } + ] + }, + "string-character-escape": { + "name": "constant.character.escape.js", + "match": "\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u\\{[0-9A-Fa-f]+\\}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.|$)" + }, + "template": { + "patterns": [ + { + "include": "#template-call" + }, + { + "contentName": "string.template.js", + "begin": "([_$[:alpha:]][_$[:alnum:]]*)?(`)", + "beginCaptures": { + "1": { + "name": "entity.name.function.tagged-template.js" + }, + "2": { + "name": "string.template.js punctuation.definition.string.template.begin.js" + } + }, + "end": "`", + "endCaptures": { + "0": { + "name": "string.template.js punctuation.definition.string.template.end.js" + } + }, + "patterns": [ + { + "include": "#template-substitution-element" + }, + { + "include": "#string-character-escape" + } + ] + } + ] + }, + "template-call": { + "patterns": [ + { + "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*)(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?`)", + "end": "(?=`)", + "patterns": [ + { + "begin": "(?=(([_$[:alpha:]][_$[:alnum:]]*\\s*\\??\\.\\s*)*|(\\??\\.\\s*)?)([_$[:alpha:]][_$[:alnum:]]*))", + "end": "(?=(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)?`)", + "patterns": [ + { + "include": "#support-function-call-identifiers" + }, + { + "name": "entity.name.function.tagged-template.js", + "match": "([_$[:alpha:]][_$[:alnum:]]*)" + } + ] + }, + { + "include": "#type-arguments" + } + ] + }, + { + "begin": "([_$[:alpha:]][_$[:alnum:]]*)?\\s*(?=(<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))(([^<>\\(]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(?<==)\\>|\\<\\s*(((keyof|infer|typeof|readonly)\\s+)|(([_$[:alpha:]][_$[:alnum:]]*|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))(?=\\s*([\\<\\>\\,\\.\\[]|=>|&(?!&)|\\|(?!\\|)))))([^<>\\(]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(?<==)\\>)*(?))*(?)*(?\\s*)`)", + "beginCaptures": { + "1": { + "name": "entity.name.function.tagged-template.js" + } + }, + "end": "(?=`)", + "patterns": [ + { + "include": "#type-arguments" + } + ] + } + ] + }, + "template-substitution-element": { + "name": "meta.template.expression.js", + "begin": "\\$\\{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.template-expression.begin.js" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.definition.template-expression.end.js" + } + }, + "patterns": [ + { + "include": "#expression" + } + ], + "contentName": "meta.embedded.line.js" + }, + "type-string": { + "patterns": [ + { + "include": "#qstring-single" + }, + { + "include": "#qstring-double" + }, + { + "include": "#template-type" + } + ] + }, + "template-type": { + "patterns": [ + { + "include": "#template-call" + }, + { + "contentName": "string.template.js", + "begin": "([_$[:alpha:]][_$[:alnum:]]*)?(`)", + "beginCaptures": { + "1": { + "name": "entity.name.function.tagged-template.js" + }, + "2": { + "name": "string.template.js punctuation.definition.string.template.begin.js" + } + }, + "end": "`", + "endCaptures": { + "0": { + "name": "string.template.js punctuation.definition.string.template.end.js" + } + }, + "patterns": [ + { + "include": "#template-type-substitution-element" + }, + { + "include": "#string-character-escape" + } + ] + } + ] + }, + "template-type-substitution-element": { + "name": "meta.template.expression.js", + "begin": "\\$\\{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.template-expression.begin.js" + } + }, + "end": "\\}", + "endCaptures": { + "0": { + "name": "punctuation.definition.template-expression.end.js" + } + }, + "patterns": [ + { + "include": "#type" + } + ], + "contentName": "meta.embedded.line.js" + }, + "regex": { + "patterns": [ + { + "name": "string.regexp.js", + "begin": "(?|&&|\\|\\||\\*\\/)\\s*(\\/)(?![\\/*])(?=(?:[^\\/\\\\\\[\\()]|\\\\.|\\[([^\\]\\\\]|\\\\.)+\\]|\\(([^\\)\\\\]|\\\\.)+\\))+\\/([dgimsuvy]+|(?![\\/\\*])|(?=\\/\\*))(?!\\s*[a-zA-Z0-9_$]))", + "beginCaptures": { + "1": { + "name": "punctuation.definition.string.begin.js" + } + }, + "end": "(/)([dgimsuvy]*)", + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.js" + }, + "2": { + "name": "keyword.other.js" + } + }, + "patterns": [ + { + "include": "#regexp" + } + ] + }, + { + "name": "string.regexp.js", + "begin": "((?", + "captures": { + "0": { + "name": "keyword.other.back-reference.regexp" + }, + "1": { + "name": "variable.other.regexp" + } + } + }, + { + "name": "keyword.operator.quantifier.regexp", + "match": "[?+*]|\\{(\\d+,\\d+|\\d+,|,\\d+|\\d+)\\}\\??" + }, + { + "name": "keyword.operator.or.regexp", + "match": "\\|" + }, + { + "name": "meta.group.assertion.regexp", + "begin": "(\\()((\\?=)|(\\?!)|(\\?<=)|(\\?))?", + "beginCaptures": { + "0": { + "name": "punctuation.definition.group.regexp" + }, + "1": { + "name": "punctuation.definition.group.no-capture.regexp" + }, + "2": { + "name": "variable.other.regexp" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.group.regexp" + } + }, + "patterns": [ + { + "include": "#regexp" + } + ] + }, + { + "name": "constant.other.character-class.set.regexp", + "begin": "(\\[)(\\^)?", + "beginCaptures": { + "1": { + "name": "punctuation.definition.character-class.regexp" + }, + "2": { + "name": "keyword.operator.negation.regexp" + } + }, + "end": "(\\])", + "endCaptures": { + "1": { + "name": "punctuation.definition.character-class.regexp" + } + }, + "patterns": [ + { + "name": "constant.other.character-class.range.regexp", + "match": "(?:.|(\\\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\\\c[A-Z])|(\\\\.))\\-(?:[^\\]\\\\]|(\\\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\\\c[A-Z])|(\\\\.))", + "captures": { + "1": { + "name": "constant.character.numeric.regexp" + }, + "2": { + "name": "constant.character.control.regexp" + }, + "3": { + "name": "constant.character.escape.backslash.regexp" + }, + "4": { + "name": "constant.character.numeric.regexp" + }, + "5": { + "name": "constant.character.control.regexp" + }, + "6": { + "name": "constant.character.escape.backslash.regexp" + } + } + }, + { + "include": "#regex-character-class" + } + ] + }, + { + "include": "#regex-character-class" + } + ] + }, + "regex-character-class": { + "patterns": [ + { + "name": "constant.other.character-class.regexp", + "match": "\\\\[wWsSdDtrnvf]|\\." + }, + { + "name": "constant.character.numeric.regexp", + "match": "\\\\([0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4})" + }, + { + "name": "constant.character.control.regexp", + "match": "\\\\c[A-Z]" + }, + { + "name": "constant.character.escape.backslash.regexp", + "match": "\\\\." + } + ] + }, + "comment": { + "patterns": [ + { + "name": "comment.block.documentation.js", + "begin": "/\\*\\*(?!/)", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.js" + } + }, + "end": "\\*/", + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.js" + } + }, + "patterns": [ + { + "include": "#docblock" + } + ] + }, + { + "name": "comment.block.js", + "begin": "(/\\*)(?:\\s*((@)internal)(?=\\s|(\\*/)))?", + "beginCaptures": { + "1": { + "name": "punctuation.definition.comment.js" + }, + "2": { + "name": "storage.type.internaldeclaration.js" + }, + "3": { + "name": "punctuation.decorator.internaldeclaration.js" + } + }, + "end": "\\*/", + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.js" + } + } + }, + { + "begin": "(^[ \\t]+)?((//)(?:\\s*((@)internal)(?=\\s|$))?)", + "beginCaptures": { + "1": { + "name": "punctuation.whitespace.comment.leading.js" + }, + "2": { + "name": "comment.line.double-slash.js" + }, + "3": { + "name": "punctuation.definition.comment.js" + }, + "4": { + "name": "storage.type.internaldeclaration.js" + }, + "5": { + "name": "punctuation.decorator.internaldeclaration.js" + } + }, + "end": "(?=$)", + "contentName": "comment.line.double-slash.js" + } + ] + }, + "single-line-comment-consuming-line-ending": { + "begin": "(^[ \\t]+)?((//)(?:\\s*((@)internal)(?=\\s|$))?)", + "beginCaptures": { + "1": { + "name": "punctuation.whitespace.comment.leading.js" + }, + "2": { + "name": "comment.line.double-slash.js" + }, + "3": { + "name": "punctuation.definition.comment.js" + }, + "4": { + "name": "storage.type.internaldeclaration.js" + }, + "5": { + "name": "punctuation.decorator.internaldeclaration.js" + } + }, + "end": "(?=^)", + "contentName": "comment.line.double-slash.js" + }, + "directives": { + "name": "comment.line.triple-slash.directive.js", + "begin": "^(///)\\s*(?=<(reference|amd-dependency|amd-module)(\\s+(path|types|no-default-lib|lib|name|resolution-mode)\\s*=\\s*((\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`)))+\\s*/>\\s*$)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.comment.js" + } + }, + "end": "(?=$)", + "patterns": [ + { + "name": "meta.tag.js", + "begin": "(<)(reference|amd-dependency|amd-module)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.tag.directive.js" + }, + "2": { + "name": "entity.name.tag.directive.js" + } + }, + "end": "/>", + "endCaptures": { + "0": { + "name": "punctuation.definition.tag.directive.js" + } + }, + "patterns": [ + { + "name": "entity.other.attribute-name.directive.js", + "match": "path|types|no-default-lib|lib|name|resolution-mode" + }, + { + "name": "keyword.operator.assignment.js", + "match": "=" + }, + { + "include": "#string" + } + ] + } + ] + }, + "docblock": { + "patterns": [ + { + "match": "(?x)\n((@)(?:access|api))\n\\s+\n(private|protected|public)\n\\b", + "captures": { + "1": { + "name": "storage.type.class.jsdoc" + }, + "2": { + "name": "punctuation.definition.block.tag.jsdoc" + }, + "3": { + "name": "constant.language.access-type.jsdoc" + } + } + }, + { + "match": "(?x)\n((@)author)\n\\s+\n(\n [^@\\s<>*/]\n (?:[^@<>*/]|\\*[^/])*\n)\n(?:\n \\s*\n (<)\n ([^>\\s]+)\n (>)\n)?", + "captures": { + "1": { + "name": "storage.type.class.jsdoc" + }, + "2": { + "name": "punctuation.definition.block.tag.jsdoc" + }, + "3": { + "name": "entity.name.type.instance.jsdoc" + }, + "4": { + "name": "punctuation.definition.bracket.angle.begin.jsdoc" + }, + "5": { + "name": "constant.other.email.link.underline.jsdoc" + }, + "6": { + "name": "punctuation.definition.bracket.angle.end.jsdoc" + } + } + }, + { + "match": "(?x)\n((@)borrows) \\s+\n((?:[^@\\s*/]|\\*[^/])+) # \n\\s+ (as) \\s+ # as\n((?:[^@\\s*/]|\\*[^/])+) # ", + "captures": { + "1": { + "name": "storage.type.class.jsdoc" + }, + "2": { + "name": "punctuation.definition.block.tag.jsdoc" + }, + "3": { + "name": "entity.name.type.instance.jsdoc" + }, + "4": { + "name": "keyword.operator.control.jsdoc" + }, + "5": { + "name": "entity.name.type.instance.jsdoc" + } + } + }, + { + "name": "meta.example.jsdoc", + "begin": "((@)example)\\s+", + "end": "(?=@|\\*/)", + "beginCaptures": { + "1": { + "name": "storage.type.class.jsdoc" + }, + "2": { + "name": "punctuation.definition.block.tag.jsdoc" + } + }, + "patterns": [ + { + "match": "^\\s\\*\\s+" + }, + { + "contentName": "constant.other.description.jsdoc", + "begin": "\\G(<)caption(>)", + "beginCaptures": { + "0": { + "name": "entity.name.tag.inline.jsdoc" + }, + "1": { + "name": "punctuation.definition.bracket.angle.begin.jsdoc" + }, + "2": { + "name": "punctuation.definition.bracket.angle.end.jsdoc" + } + }, + "end": "()|(?=\\*/)", + "endCaptures": { + "0": { + "name": "entity.name.tag.inline.jsdoc" + }, + "1": { + "name": "punctuation.definition.bracket.angle.begin.jsdoc" + }, + "2": { + "name": "punctuation.definition.bracket.angle.end.jsdoc" + } + } + }, + { + "match": "[^\\s@*](?:[^*]|\\*[^/])*", + "captures": { + "0": { + "name": "source.embedded.js" + } + } + } + ] + }, + { + "match": "(?x) ((@)kind) \\s+ (class|constant|event|external|file|function|member|mixin|module|namespace|typedef) \\b", + "captures": { + "1": { + "name": "storage.type.class.jsdoc" + }, + "2": { + "name": "punctuation.definition.block.tag.jsdoc" + }, + "3": { + "name": "constant.language.symbol-type.jsdoc" + } + } + }, + { + "match": "(?x)\n((@)see)\n\\s+\n(?:\n # URL\n (\n (?=https?://)\n (?:[^\\s*]|\\*[^/])+\n )\n |\n # JSDoc namepath\n (\n (?!\n # Avoid matching bare URIs (also acceptable as links)\n https?://\n |\n # Avoid matching {@inline tags}; we match those below\n (?:\\[[^\\[\\]]*\\])? # Possible description [preceding]{@tag}\n {@(?:link|linkcode|linkplain|tutorial)\\b\n )\n # Matched namepath\n (?:[^@\\s*/]|\\*[^/])+\n )\n)", + "captures": { + "1": { + "name": "storage.type.class.jsdoc" + }, + "2": { + "name": "punctuation.definition.block.tag.jsdoc" + }, + "3": { + "name": "variable.other.link.underline.jsdoc" + }, + "4": { + "name": "entity.name.type.instance.jsdoc" + } + } + }, + { + "match": "(?x)\n((@)template)\n\\s+\n# One or more valid identifiers\n(\n [A-Za-z_$] # First character: non-numeric word character\n [\\w$.\\[\\]]* # Rest of identifier\n (?: # Possible list of additional identifiers\n \\s* , \\s*\n [A-Za-z_$]\n [\\w$.\\[\\]]*\n )*\n)", + "captures": { + "1": { + "name": "storage.type.class.jsdoc" + }, + "2": { + "name": "punctuation.definition.block.tag.jsdoc" + }, + "3": { + "name": "variable.other.jsdoc" + } + } + }, + { + "begin": "(?x)((@)template)\\s+(?={)", + "beginCaptures": { + "1": { + "name": "storage.type.class.jsdoc" + }, + "2": { + "name": "punctuation.definition.block.tag.jsdoc" + } + }, + "end": "(?=\\s|\\*/|[^{}\\[\\]A-Za-z_$])", + "patterns": [ + { + "include": "#jsdoctype" + }, + { + "name": "variable.other.jsdoc", + "match": "([A-Za-z_$][\\w$.\\[\\]]*)" + } + ] + }, + { + "match": "(?x)\n(\n (@)\n (?:arg|argument|const|constant|member|namespace|param|var)\n)\n\\s+\n(\n [A-Za-z_$]\n [\\w$.\\[\\]]*\n)", + "captures": { + "1": { + "name": "storage.type.class.jsdoc" + }, + "2": { + "name": "punctuation.definition.block.tag.jsdoc" + }, + "3": { + "name": "variable.other.jsdoc" + } + } + }, + { + "begin": "((@)typedef)\\s+(?={)", + "beginCaptures": { + "1": { + "name": "storage.type.class.jsdoc" + }, + "2": { + "name": "punctuation.definition.block.tag.jsdoc" + } + }, + "end": "(?=\\s|\\*/|[^{}\\[\\]A-Za-z_$])", + "patterns": [ + { + "include": "#jsdoctype" + }, + { + "name": "entity.name.type.instance.jsdoc", + "match": "(?:[^@\\s*/]|\\*[^/])+" + } + ] + }, + { + "begin": "((@)(?:arg|argument|const|constant|member|namespace|param|prop|property|var))\\s+(?={)", + "beginCaptures": { + "1": { + "name": "storage.type.class.jsdoc" + }, + "2": { + "name": "punctuation.definition.block.tag.jsdoc" + } + }, + "end": "(?=\\s|\\*/|[^{}\\[\\]A-Za-z_$])", + "patterns": [ + { + "include": "#jsdoctype" + }, + { + "name": "variable.other.jsdoc", + "match": "([A-Za-z_$][\\w$.\\[\\]]*)" + }, + { + "name": "variable.other.jsdoc", + "match": "(?x)\n(\\[)\\s*\n[\\w$]+\n(?:\n (?:\\[\\])? # Foo[ ].bar properties within an array\n \\. # Foo.Bar namespaced parameter\n [\\w$]+\n)*\n(?:\n \\s*\n (=) # [foo=bar] Default parameter value\n \\s*\n (\n # The inner regexes are to stop the match early at */ and to not stop at escaped quotes\n (?>\n \"(?:(?:\\*(?!/))|(?:\\\\(?!\"))|[^*\\\\])*?\" | # [foo=\"bar\"] Double-quoted\n '(?:(?:\\*(?!/))|(?:\\\\(?!'))|[^*\\\\])*?' | # [foo='bar'] Single-quoted\n \\[ (?:(?:\\*(?!/))|[^*])*? \\] | # [foo=[1,2]] Array literal\n (?:(?:\\*(?!/))|\\s(?!\\s*\\])|\\[.*?(?:\\]|(?=\\*/))|[^*\\s\\[\\]])* # Everything else\n )*\n )\n)?\n\\s*(?:(\\])((?:[^*\\s]|\\*[^\\s/])+)?|(?=\\*/))", + "captures": { + "1": { + "name": "punctuation.definition.optional-value.begin.bracket.square.jsdoc" + }, + "2": { + "name": "keyword.operator.assignment.jsdoc" + }, + "3": { + "name": "source.embedded.js" + }, + "4": { + "name": "punctuation.definition.optional-value.end.bracket.square.jsdoc" + }, + "5": { + "name": "invalid.illegal.syntax.jsdoc" + } + } + } + ] + }, + { + "begin": "(?x)\n(\n (@)\n (?:define|enum|exception|export|extends|lends|implements|modifies\n |namespace|private|protected|returns?|satisfies|suppress|this|throws|type\n |yields?)\n)\n\\s+(?={)", + "beginCaptures": { + "1": { + "name": "storage.type.class.jsdoc" + }, + "2": { + "name": "punctuation.definition.block.tag.jsdoc" + } + }, + "end": "(?=\\s|\\*/|[^{}\\[\\]A-Za-z_$])", + "patterns": [ + { + "include": "#jsdoctype" + } + ] + }, + { + "match": "(?x)\n(\n (@)\n (?:alias|augments|callback|constructs|emits|event|fires|exports?\n |extends|external|function|func|host|lends|listens|interface|memberof!?\n |method|module|mixes|mixin|name|requires|see|this|typedef|uses)\n)\n\\s+\n(\n (?:\n [^{}@\\s*] | \\*[^/]\n )+\n)", + "captures": { + "1": { + "name": "storage.type.class.jsdoc" + }, + "2": { + "name": "punctuation.definition.block.tag.jsdoc" + }, + "3": { + "name": "entity.name.type.instance.jsdoc" + } + } + }, + { + "contentName": "variable.other.jsdoc", + "begin": "((@)(?:default(?:value)?|license|version))\\s+(([''\"]))", + "beginCaptures": { + "1": { + "name": "storage.type.class.jsdoc" + }, + "2": { + "name": "punctuation.definition.block.tag.jsdoc" + }, + "3": { + "name": "variable.other.jsdoc" + }, + "4": { + "name": "punctuation.definition.string.begin.jsdoc" + } + }, + "end": "(\\3)|(?=$|\\*/)", + "endCaptures": { + "0": { + "name": "variable.other.jsdoc" + }, + "1": { + "name": "punctuation.definition.string.end.jsdoc" + } + } + }, + { + "match": "((@)(?:default(?:value)?|license|tutorial|variation|version))\\s+([^\\s*]+)", + "captures": { + "1": { + "name": "storage.type.class.jsdoc" + }, + "2": { + "name": "punctuation.definition.block.tag.jsdoc" + }, + "3": { + "name": "variable.other.jsdoc" + } + } + }, + { + "name": "storage.type.class.jsdoc", + "match": "(?x) (@) (?:abstract|access|alias|api|arg|argument|async|attribute|augments|author|beta|borrows|bubbles |callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright |default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exception |exports?|extends|extension(?:_?for)?|external|externs|file|fileoverview|final|fires|for|func |function|generator|global|hideconstructor|host|ignore|implements|implicitCast|inherit[Dd]oc |inner|instance|interface|internal|kind|lends|license|listens|main|member|memberof!?|method |mixes|mixins?|modifies|module|name|namespace|noalias|nocollapse|nocompile|nosideeffects |override|overview|package|param|polymer(?:Behavior)?|preserve|private|prop|property|protected |public|read[Oo]nly|record|require[ds]|returns?|see|since|static|struct|submodule|summary |suppress|template|this|throws|todo|tutorial|type|typedef|unrestricted|uses|var|variation |version|virtual|writeOnce|yields?) \\b", + "captures": { + "1": { + "name": "punctuation.definition.block.tag.jsdoc" + } + } + }, + { + "include": "#inline-tags" + }, + { + "match": "((@)(?:[_$[:alpha:]][_$[:alnum:]]*))(?=\\s+)", + "captures": { + "1": { + "name": "storage.type.class.jsdoc" + }, + "2": { + "name": "punctuation.definition.block.tag.jsdoc" + } + } + } + ] + }, + "brackets": { + "patterns": [ + { + "begin": "{", + "end": "}|(?=\\*/)", + "patterns": [ + { + "include": "#brackets" + } + ] + }, + { + "begin": "\\[", + "end": "\\]|(?=\\*/)", + "patterns": [ + { + "include": "#brackets" + } + ] + } + ] + }, + "inline-tags": { + "patterns": [ + { + "name": "constant.other.description.jsdoc", + "match": "(\\[)[^\\]]+(\\])(?={@(?:link|linkcode|linkplain|tutorial))", + "captures": { + "1": { + "name": "punctuation.definition.bracket.square.begin.jsdoc" + }, + "2": { + "name": "punctuation.definition.bracket.square.end.jsdoc" + } + } + }, + { + "name": "entity.name.type.instance.jsdoc", + "begin": "({)((@)(?:link(?:code|plain)?|tutorial))\\s*", + "beginCaptures": { + "1": { + "name": "punctuation.definition.bracket.curly.begin.jsdoc" + }, + "2": { + "name": "storage.type.class.jsdoc" + }, + "3": { + "name": "punctuation.definition.inline.tag.jsdoc" + } + }, + "end": "}|(?=\\*/)", + "endCaptures": { + "0": { + "name": "punctuation.definition.bracket.curly.end.jsdoc" + } + }, + "patterns": [ + { + "match": "\\G((?=https?://)(?:[^|}\\s*]|\\*[/])+)(\\|)?", + "captures": { + "1": { + "name": "variable.other.link.underline.jsdoc" + }, + "2": { + "name": "punctuation.separator.pipe.jsdoc" + } + } + }, + { + "match": "\\G((?:[^{}@\\s|*]|\\*[^/])+)(\\|)?", + "captures": { + "1": { + "name": "variable.other.description.jsdoc" + }, + "2": { + "name": "punctuation.separator.pipe.jsdoc" + } + } + } + ] + } + ] + }, + "jsdoctype": { + "patterns": [ + { + "contentName": "entity.name.type.instance.jsdoc", + "begin": "\\G({)", + "beginCaptures": { + "0": { + "name": "entity.name.type.instance.jsdoc" + }, + "1": { + "name": "punctuation.definition.bracket.curly.begin.jsdoc" + } + }, + "end": "((}))\\s*|(?=\\*/)", + "endCaptures": { + "1": { + "name": "entity.name.type.instance.jsdoc" + }, + "2": { + "name": "punctuation.definition.bracket.curly.end.jsdoc" + } + }, + "patterns": [ + { + "include": "#brackets" + } + ] + } + ] + }, + "jsx": { + "patterns": [ + { + "include": "#jsx-tag-without-attributes-in-expression" + }, + { + "include": "#jsx-tag-in-expression" + } + ] + }, + "jsx-tag-without-attributes-in-expression": { + "begin": "(?:*]|&&|\\|\\||\\?|\\*\\/|^await|[^\\._$[:alnum:]]await|^return|[^\\._$[:alnum:]]return|^default|[^\\._$[:alnum:]]default|^yield|[^\\._$[:alnum:]]yield|^)\\s*(?=(<)\\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?))", + "end": "(?!(<)\\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?))", + "patterns": [ + { + "include": "#jsx-tag-without-attributes" + } + ] + }, + "jsx-tag-without-attributes": { + "name": "meta.tag.without-attributes.js", + "begin": "(<)\\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?)", + "end": "()", + "beginCaptures": { + "1": { + "name": "punctuation.definition.tag.begin.js" + }, + "2": { + "name": "entity.name.tag.namespace.js" + }, + "3": { + "name": "punctuation.separator.namespace.js" + }, + "4": { + "name": "entity.name.tag.js" + }, + "5": { + "name": "support.class.component.js" + }, + "6": { + "name": "punctuation.definition.tag.end.js" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.tag.begin.js" + }, + "2": { + "name": "entity.name.tag.namespace.js" + }, + "3": { + "name": "punctuation.separator.namespace.js" + }, + "4": { + "name": "entity.name.tag.js" + }, + "5": { + "name": "support.class.component.js" + }, + "6": { + "name": "punctuation.definition.tag.end.js" + } + }, + "contentName": "meta.jsx.children.js", + "patterns": [ + { + "include": "#jsx-children" + } + ] + }, + "jsx-tag-in-expression": { + "begin": "(?x)\n (?:*]|&&|\\|\\||\\?|\\*\\/|^await|[^\\._$[:alnum:]]await|^return|[^\\._$[:alnum:]]return|^default|[^\\._$[:alnum:]]default|^yield|[^\\._$[:alnum:]]yield|^)\\s*\n (?!<\\s*[_$[:alpha:]][_$[:alnum:]]*((\\s+extends\\s+[^=>])|,)) # look ahead is not type parameter of arrow\n (?=(<)\\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?))", + "end": "(?!(<)\\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?))", + "patterns": [ + { + "include": "#jsx-tag" + } + ] + }, + "jsx-tag": { + "name": "meta.tag.js", + "begin": "(?=(<)\\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?))", + "end": "(/>)|(?:())", + "endCaptures": { + "1": { + "name": "punctuation.definition.tag.end.js" + }, + "2": { + "name": "punctuation.definition.tag.begin.js" + }, + "3": { + "name": "entity.name.tag.namespace.js" + }, + "4": { + "name": "punctuation.separator.namespace.js" + }, + "5": { + "name": "entity.name.tag.js" + }, + "6": { + "name": "support.class.component.js" + }, + "7": { + "name": "punctuation.definition.tag.end.js" + } + }, + "patterns": [ + { + "begin": "(<)\\s*(?:([_$[:alpha:]][-_$[:alnum:].]*)(?)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.tag.begin.js" + }, + "2": { + "name": "entity.name.tag.namespace.js" + }, + "3": { + "name": "punctuation.separator.namespace.js" + }, + "4": { + "name": "entity.name.tag.js" + }, + "5": { + "name": "support.class.component.js" + } + }, + "end": "(?=[/]?>)", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#type-arguments" + }, + { + "include": "#jsx-tag-attributes" + } + ] + }, + { + "begin": "(>)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.tag.end.js" + } + }, + "end": "(?=)", + "patterns": [ + { + "include": "#comment" + }, + { + "include": "#jsx-tag-attribute-name" + }, + { + "include": "#jsx-tag-attribute-assignment" + }, + { + "include": "#jsx-string-double-quoted" + }, + { + "include": "#jsx-string-single-quoted" + }, + { + "include": "#jsx-evaluated-code" + }, + { + "include": "#jsx-tag-attributes-illegal" + } + ] + }, + "jsx-tag-attribute-name": { + "match": "(?x)\n \\s*\n (?:([_$[:alpha:]][-_$[:alnum:].]*)(:))?\n ([_$[:alpha:]][-_$[:alnum:]]*)\n (?=\\s|=|/?>|/\\*|//)", + "captures": { + "1": { + "name": "entity.other.attribute-name.namespace.js" + }, + "2": { + "name": "punctuation.separator.namespace.js" + }, + "3": { + "name": "entity.other.attribute-name.js" + } + } + }, + "jsx-tag-attribute-assignment": { + "name": "keyword.operator.assignment.js", + "match": "=(?=\\s*(?:'|\"|{|/\\*|//|\\n))" + }, + "jsx-string-double-quoted": { + "name": "string.quoted.double.js", + "begin": "\"", + "end": "\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.js" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.js" + } + }, + "patterns": [ + { + "include": "#jsx-entities" + } + ] + }, + "jsx-string-single-quoted": { + "name": "string.quoted.single.js", + "begin": "'", + "end": "'", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.js" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.js" + } + }, + "patterns": [ + { + "include": "#jsx-entities" + } + ] + }, + "jsx-tag-attributes-illegal": { + "name": "invalid.illegal.attribute.js", + "match": "\\S+" + } + } +} \ No newline at end of file diff --git a/language/syntaxes/test/injected-grammars/MagicPython.tmLanguage.json b/language/syntaxes/test/injected-grammars/MagicPython.tmLanguage.json new file mode 100644 index 00000000..91a2c8e7 --- /dev/null +++ b/language/syntaxes/test/injected-grammars/MagicPython.tmLanguage.json @@ -0,0 +1,4213 @@ +{ + "information_for_contributors": [ + "This file has been converted from https://github.com/MagicStack/MagicPython/blob/master/grammars/MagicPython.tmLanguage", + "If you want to provide a fix or improvement, please create a pull request against the original repository.", + "Once accepted there, we are happy to receive an update request." + ], + "version": "https://github.com/MagicStack/MagicPython/commit/7d0f2b22a5ad8fccbd7341bc7b7a715169283044", + "name": "MagicPython", + "scopeName": "source.python", + "patterns": [ + { + "include": "#statement" + }, + { + "include": "#expression" + } + ], + "repository": { + "impossible": { + "comment": "This is a special rule that should be used where no match is desired. It is not a good idea to match something like '1{0}' because in some cases that can result in infinite loops in token generation. So the rule instead matches and impossible expression to allow a match to fail and move to the next token.", + "match": "$.^" + }, + "statement": { + "patterns": [ + { + "include": "#import" + }, + { + "include": "#class-declaration" + }, + { + "include": "#function-declaration" + }, + { + "include": "#generator" + }, + { + "include": "#statement-keyword" + }, + { + "include": "#assignment-operator" + }, + { + "include": "#decorator" + }, + { + "include": "#docstring-statement" + }, + { + "include": "#semicolon" + } + ] + }, + "semicolon": { + "patterns": [ + { + "name": "invalid.deprecated.semicolon.python", + "match": "\\;$" + } + ] + }, + "comments": { + "patterns": [ + { + "name": "comment.line.number-sign.python", + "contentName": "meta.typehint.comment.python", + "begin": "(?x)\n (?:\n \\# \\s* (type:)\n \\s*+ (?# we want `\\s*+` which is possessive quantifier since\n we do not actually want to backtrack when matching\n whitespace here)\n (?! $ | \\#)\n )\n", + "end": "(?:$|(?=\\#))", + "beginCaptures": { + "0": { + "name": "meta.typehint.comment.python" + }, + "1": { + "name": "comment.typehint.directive.notation.python" + } + }, + "patterns": [ + { + "name": "comment.typehint.ignore.notation.python", + "match": "(?x)\n \\G ignore\n (?= \\s* (?: $ | \\#))\n" + }, + { + "name": "comment.typehint.type.notation.python", + "match": "(?x)\n (?))" + }, + { + "name": "comment.typehint.variable.notation.python", + "match": "([[:alpha:]_]\\w*)" + } + ] + }, + { + "include": "#comments-base" + } + ] + }, + "docstring-statement": { + "begin": "^(?=\\s*[rR]?(\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))", + "comment": "the string either terminates correctly or by the beginning of a new line (this is for single line docstrings that aren't terminated) AND it's not followed by another docstring", + "end": "((?<=\\1)|^)(?!\\s*[rR]?(\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))", + "patterns": [ + { + "include": "#docstring" + } + ] + }, + "docstring": { + "patterns": [ + { + "name": "string.quoted.docstring.multi.python", + "begin": "(\\'\\'\\'|\\\"\\\"\\\")", + "end": "(\\1)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.string.begin.python" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.python" + } + }, + "patterns": [ + { + "include": "#docstring-prompt" + }, + { + "include": "#codetags" + }, + { + "include": "#docstring-guts-unicode" + } + ] + }, + { + "name": "string.quoted.docstring.raw.multi.python", + "begin": "([rR])(\\'\\'\\'|\\\"\\\"\\\")", + "end": "(\\2)", + "beginCaptures": { + "1": { + "name": "storage.type.string.python" + }, + "2": { + "name": "punctuation.definition.string.begin.python" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.python" + } + }, + "patterns": [ + { + "include": "#string-consume-escape" + }, + { + "include": "#docstring-prompt" + }, + { + "include": "#codetags" + } + ] + }, + { + "name": "string.quoted.docstring.single.python", + "begin": "(\\'|\\\")", + "end": "(\\1)|(\\n)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.string.begin.python" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.python" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#codetags" + }, + { + "include": "#docstring-guts-unicode" + } + ] + }, + { + "name": "string.quoted.docstring.raw.single.python", + "begin": "([rR])(\\'|\\\")", + "end": "(\\2)|(\\n)", + "beginCaptures": { + "1": { + "name": "storage.type.string.python" + }, + "2": { + "name": "punctuation.definition.string.begin.python" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.python" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#string-consume-escape" + }, + { + "include": "#codetags" + } + ] + } + ] + }, + "docstring-guts-unicode": { + "patterns": [ + { + "include": "#escape-sequence-unicode" + }, + { + "include": "#escape-sequence" + }, + { + "include": "#string-line-continuation" + } + ] + }, + "docstring-prompt": { + "match": "(?x)\n (?:\n (?:^|\\G) \\s* (?# '\\G' is necessary for ST)\n ((?:>>>|\\.\\.\\.) \\s) (?=\\s*\\S)\n )\n", + "captures": { + "1": { + "name": "keyword.control.flow.python" + } + } + }, + "statement-keyword": { + "patterns": [ + { + "name": "storage.type.function.python", + "match": "\\b((async\\s+)?\\s*def)\\b" + }, + { + "name": "keyword.control.flow.python", + "comment": "if `as` is eventually followed by `:` or line continuation\nit's probably control flow like:\n with foo as bar, \\\n Foo as Bar:\n try:\n do_stuff()\n except Exception as e:\n pass\n", + "match": "\\b(?>= | //= | \\*\\*=\n | \\+= | -= | /= | @=\n | \\*= | %= | ~= | \\^= | &= | \\|=\n | =(?!=)\n" + }, + "operator": { + "match": "(?x)\n \\b(?> | & | \\| | \\^ | ~) (?# 3)\n\n | (\\*\\* | \\* | \\+ | - | % | // | / | @) (?# 4)\n\n | (!= | == | >= | <= | < | >) (?# 5)\n\n | (:=) (?# 6)\n", + "captures": { + "1": { + "name": "keyword.operator.logical.python" + }, + "2": { + "name": "keyword.control.flow.python" + }, + "3": { + "name": "keyword.operator.bitwise.python" + }, + "4": { + "name": "keyword.operator.arithmetic.python" + }, + "5": { + "name": "keyword.operator.comparison.python" + }, + "6": { + "name": "keyword.operator.assignment.python" + } + } + }, + "punctuation": { + "patterns": [ + { + "name": "punctuation.separator.colon.python", + "match": ":" + }, + { + "name": "punctuation.separator.element.python", + "match": "," + } + ] + }, + "literal": { + "patterns": [ + { + "name": "constant.language.python", + "match": "\\b(True|False|None|NotImplemented|Ellipsis)\\b" + }, + { + "include": "#number" + } + ] + }, + "number": { + "name": "constant.numeric.python", + "patterns": [ + { + "include": "#number-float" + }, + { + "include": "#number-dec" + }, + { + "include": "#number-hex" + }, + { + "include": "#number-oct" + }, + { + "include": "#number-bin" + }, + { + "include": "#number-long" + }, + { + "name": "invalid.illegal.name.python", + "match": "\\b[0-9]+\\w+" + } + ] + }, + "number-float": { + "name": "constant.numeric.float.python", + "match": "(?x)\n (?=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )?\n })\n )\n", + "captures": { + "1": { + "name": "constant.character.format.placeholder.other.python" + }, + "3": { + "name": "storage.type.format.python" + }, + "4": { + "name": "storage.type.format.python" + } + } + }, + { + "name": "meta.format.brace.python", + "match": "(?x)\n (\n {\n \\w* (\\.[[:alpha:]_]\\w* | \\[[^\\]'\"]+\\])*\n (![rsa])?\n (:)\n [^'\"{}\\n]* (?:\n \\{ [^'\"}\\n]*? \\} [^'\"{}\\n]*\n )*\n }\n )\n", + "captures": { + "1": { + "name": "constant.character.format.placeholder.other.python" + }, + "3": { + "name": "storage.type.format.python" + }, + "4": { + "name": "storage.type.format.python" + } + } + } + ] + }, + "fstring-formatting": { + "patterns": [ + { + "include": "#fstring-formatting-braces" + }, + { + "include": "#fstring-formatting-singe-brace" + } + ] + }, + "fstring-formatting-singe-brace": { + "name": "invalid.illegal.brace.python", + "match": "(}(?!}))" + }, + "import": { + "comment": "Import statements used to correctly mark `from`, `import`, and `as`\n", + "patterns": [ + { + "begin": "\\b(?)", + "end": "(?=:)", + "beginCaptures": { + "1": { + "name": "punctuation.separator.annotation.result.python" + } + }, + "patterns": [ + { + "include": "#expression" + } + ] + }, + "item-access": { + "patterns": [ + { + "name": "meta.item-access.python", + "begin": "(?x)\n \\b(?=\n [[:alpha:]_]\\w* \\s* \\[\n )\n", + "end": "(\\])", + "endCaptures": { + "1": { + "name": "punctuation.definition.arguments.end.python" + } + }, + "patterns": [ + { + "include": "#item-name" + }, + { + "include": "#item-index" + }, + { + "include": "#expression" + } + ] + } + ] + }, + "item-name": { + "patterns": [ + { + "include": "#special-variables" + }, + { + "include": "#builtin-functions" + }, + { + "include": "#special-names" + }, + { + "name": "meta.indexed-name.python", + "match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\b\n" + } + ] + }, + "item-index": { + "begin": "(\\[)", + "end": "(?=\\])", + "beginCaptures": { + "1": { + "name": "punctuation.definition.arguments.begin.python" + } + }, + "contentName": "meta.item-access.arguments.python", + "patterns": [ + { + "name": "punctuation.separator.slice.python", + "match": ":" + }, + { + "include": "#expression" + } + ] + }, + "decorator": { + "name": "meta.function.decorator.python", + "begin": "(?x)\n ^\\s*\n ((@)) \\s* (?=[[:alpha:]_]\\w*)\n", + "end": "(?x)\n ( \\) )\n # trailing whitespace and comments are legal\n (?: (.*?) (?=\\s*(?:\\#|$)) )\n | (?=\\n|\\#)\n", + "beginCaptures": { + "1": { + "name": "entity.name.function.decorator.python" + }, + "2": { + "name": "punctuation.definition.decorator.python" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.arguments.end.python" + }, + "2": { + "name": "invalid.illegal.decorator.python" + } + }, + "patterns": [ + { + "include": "#decorator-name" + }, + { + "include": "#function-arguments" + } + ] + }, + "decorator-name": { + "patterns": [ + { + "include": "#builtin-callables" + }, + { + "include": "#illegal-object-name" + }, + { + "name": "entity.name.function.decorator.python", + "match": "(?x)\n ([[:alpha:]_]\\w*) | (\\.)\n", + "captures": { + "2": { + "name": "punctuation.separator.period.python" + } + } + }, + { + "include": "#line-continuation" + }, + { + "name": "invalid.illegal.decorator.python", + "match": "(?x)\n \\s* ([^([:alpha:]\\s_\\.#\\\\] .*?) (?=\\#|$)\n", + "captures": { + "1": { + "name": "invalid.illegal.decorator.python" + } + } + } + ] + }, + "call-wrapper-inheritance": { + "comment": "same as a function call, but in inheritance context", + "name": "meta.function-call.python", + "begin": "(?x)\n \\b(?=\n ([[:alpha:]_]\\w*) \\s* (\\()\n )\n", + "end": "(\\))", + "endCaptures": { + "1": { + "name": "punctuation.definition.arguments.end.python" + } + }, + "patterns": [ + { + "include": "#inheritance-name" + }, + { + "include": "#function-arguments" + } + ] + }, + "inheritance-name": { + "patterns": [ + { + "include": "#lambda-incomplete" + }, + { + "include": "#builtin-possible-callables" + }, + { + "include": "#inheritance-identifier" + } + ] + }, + "function-call": { + "name": "meta.function-call.python", + "comment": "Regular function call of the type \"name(args)\"", + "begin": "(?x)\n \\b(?=\n ([[:alpha:]_]\\w*) \\s* (\\()\n )\n", + "end": "(\\))", + "endCaptures": { + "1": { + "name": "punctuation.definition.arguments.end.python" + } + }, + "patterns": [ + { + "include": "#special-variables" + }, + { + "include": "#function-name" + }, + { + "include": "#function-arguments" + } + ] + }, + "function-name": { + "patterns": [ + { + "include": "#builtin-possible-callables" + }, + { + "comment": "Some color schemas support meta.function-call.generic scope", + "name": "meta.function-call.generic.python", + "match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\b\n" + } + ] + }, + "function-arguments": { + "begin": "(\\()", + "end": "(?=\\))(?!\\)\\s*\\()", + "beginCaptures": { + "1": { + "name": "punctuation.definition.arguments.begin.python" + } + }, + "contentName": "meta.function-call.arguments.python", + "patterns": [ + { + "name": "punctuation.separator.arguments.python", + "match": "(,)" + }, + { + "match": "(?x)\n (?:(?<=[,(])|^) \\s* (\\*{1,2})\n", + "captures": { + "1": { + "name": "keyword.operator.unpacking.arguments.python" + } + } + }, + { + "include": "#lambda-incomplete" + }, + { + "include": "#illegal-names" + }, + { + "match": "\\b([[:alpha:]_]\\w*)\\s*(=)(?!=)", + "captures": { + "1": { + "name": "variable.parameter.function-call.python" + }, + "2": { + "name": "keyword.operator.assignment.python" + } + } + }, + { + "name": "keyword.operator.assignment.python", + "match": "=(?!=)" + }, + { + "include": "#expression" + }, + { + "match": "\\s*(\\))\\s*(\\()", + "captures": { + "1": { + "name": "punctuation.definition.arguments.end.python" + }, + "2": { + "name": "punctuation.definition.arguments.begin.python" + } + } + } + ] + }, + "builtin-callables": { + "patterns": [ + { + "include": "#illegal-names" + }, + { + "include": "#illegal-object-name" + }, + { + "include": "#builtin-exceptions" + }, + { + "include": "#builtin-functions" + }, + { + "include": "#builtin-types" + } + ] + }, + "builtin-possible-callables": { + "patterns": [ + { + "include": "#builtin-callables" + }, + { + "include": "#magic-names" + } + ] + }, + "builtin-exceptions": { + "name": "support.type.exception.python", + "match": "(?x) (?" + }, + "regexp-base-expression": { + "patterns": [ + { + "include": "#regexp-quantifier" + }, + { + "include": "#regexp-base-common" + } + ] + }, + "fregexp-base-expression": { + "patterns": [ + { + "include": "#fregexp-quantifier" + }, + { + "include": "#fstring-formatting-braces" + }, + { + "match": "\\{.*?\\}" + }, + { + "include": "#regexp-base-common" + } + ] + }, + "fstring-formatting-braces": { + "patterns": [ + { + "comment": "empty braces are illegal", + "match": "({)(\\s*?)(})", + "captures": { + "1": { + "name": "constant.character.format.placeholder.other.python" + }, + "2": { + "name": "invalid.illegal.brace.python" + }, + "3": { + "name": "constant.character.format.placeholder.other.python" + } + } + }, + { + "name": "constant.character.escape.python", + "match": "({{|}})" + } + ] + }, + "regexp-base-common": { + "patterns": [ + { + "name": "support.other.match.any.regexp", + "match": "\\." + }, + { + "name": "support.other.match.begin.regexp", + "match": "\\^" + }, + { + "name": "support.other.match.end.regexp", + "match": "\\$" + }, + { + "name": "keyword.operator.quantifier.regexp", + "match": "[+*?]\\??" + }, + { + "name": "keyword.operator.disjunction.regexp", + "match": "\\|" + }, + { + "include": "#regexp-escape-sequence" + } + ] + }, + "regexp-quantifier": { + "name": "keyword.operator.quantifier.regexp", + "match": "(?x)\n \\{(\n \\d+ | \\d+,(\\d+)? | ,\\d+\n )\\}\n" + }, + "fregexp-quantifier": { + "name": "keyword.operator.quantifier.regexp", + "match": "(?x)\n \\{\\{(\n \\d+ | \\d+,(\\d+)? | ,\\d+\n )\\}\\}\n" + }, + "regexp-backreference-number": { + "name": "meta.backreference.regexp", + "match": "(\\\\[1-9]\\d?)", + "captures": { + "1": { + "name": "entity.name.tag.backreference.regexp" + } + } + }, + "regexp-backreference": { + "name": "meta.backreference.named.regexp", + "match": "(?x)\n (\\() (\\?P= \\w+(?:\\s+[[:alnum:]]+)?) (\\))\n", + "captures": { + "1": { + "name": "support.other.parenthesis.regexp punctuation.parenthesis.backreference.named.begin.regexp" + }, + "2": { + "name": "entity.name.tag.named.backreference.regexp" + }, + "3": { + "name": "support.other.parenthesis.regexp punctuation.parenthesis.backreference.named.end.regexp" + } + } + }, + "regexp-flags": { + "name": "storage.modifier.flag.regexp", + "match": "\\(\\?[aiLmsux]+\\)" + }, + "regexp-escape-special": { + "name": "support.other.escape.special.regexp", + "match": "\\\\([AbBdDsSwWZ])" + }, + "regexp-escape-character": { + "name": "constant.character.escape.regexp", + "match": "(?x)\n \\\\ (\n x[0-9A-Fa-f]{2}\n | 0[0-7]{1,2}\n | [0-7]{3}\n )\n" + }, + "regexp-escape-unicode": { + "name": "constant.character.unicode.regexp", + "match": "(?x)\n \\\\ (\n u[0-9A-Fa-f]{4}\n | U[0-9A-Fa-f]{8}\n )\n" + }, + "regexp-escape-catchall": { + "name": "constant.character.escape.regexp", + "match": "\\\\(.|\\n)" + }, + "regexp-escape-sequence": { + "patterns": [ + { + "include": "#regexp-escape-special" + }, + { + "include": "#regexp-escape-character" + }, + { + "include": "#regexp-escape-unicode" + }, + { + "include": "#regexp-backreference-number" + }, + { + "include": "#regexp-escape-catchall" + } + ] + }, + "regexp-charecter-set-escapes": { + "patterns": [ + { + "name": "constant.character.escape.regexp", + "match": "\\\\[abfnrtv\\\\]" + }, + { + "include": "#regexp-escape-special" + }, + { + "name": "constant.character.escape.regexp", + "match": "\\\\([0-7]{1,3})" + }, + { + "include": "#regexp-escape-character" + }, + { + "include": "#regexp-escape-unicode" + }, + { + "include": "#regexp-escape-catchall" + } + ] + }, + "codetags": { + "match": "(?:\\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\\b)", + "captures": { + "1": { + "name": "keyword.codetag.notation.python" + } + } + }, + "comments-base": { + "name": "comment.line.number-sign.python", + "begin": "(\\#)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.comment.python" + } + }, + "end": "($)", + "patterns": [ + { + "include": "#codetags" + } + ] + }, + "comments-string-single-three": { + "name": "comment.line.number-sign.python", + "begin": "(\\#)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.comment.python" + } + }, + "end": "($|(?='''))", + "patterns": [ + { + "include": "#codetags" + } + ] + }, + "comments-string-double-three": { + "name": "comment.line.number-sign.python", + "begin": "(\\#)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.comment.python" + } + }, + "end": "($|(?=\"\"\"))", + "patterns": [ + { + "include": "#codetags" + } + ] + }, + "single-one-regexp-expression": { + "patterns": [ + { + "include": "#regexp-base-expression" + }, + { + "include": "#single-one-regexp-character-set" + }, + { + "include": "#single-one-regexp-comments" + }, + { + "include": "#regexp-flags" + }, + { + "include": "#single-one-regexp-named-group" + }, + { + "include": "#regexp-backreference" + }, + { + "include": "#single-one-regexp-lookahead" + }, + { + "include": "#single-one-regexp-lookahead-negative" + }, + { + "include": "#single-one-regexp-lookbehind" + }, + { + "include": "#single-one-regexp-lookbehind-negative" + }, + { + "include": "#single-one-regexp-conditional" + }, + { + "include": "#single-one-regexp-parentheses-non-capturing" + }, + { + "include": "#single-one-regexp-parentheses" + } + ] + }, + "single-one-regexp-character-set": { + "patterns": [ + { + "match": "(?x)\n \\[ \\^? \\] (?! .*?\\])\n" + }, + { + "name": "meta.character.set.regexp", + "begin": "(\\[)(\\^)?(\\])?", + "end": "(\\]|(?=\\'))|((?=(?)\n", + "end": "(\\)|(?=\\'))|((?=(?)\n", + "end": "(\\)|(?=\\'\\'\\'))", + "beginCaptures": { + "1": { + "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp" + }, + "2": { + "name": "entity.name.tag.named.group.regexp" + } + }, + "endCaptures": { + "1": { + "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#single-three-regexp-expression" + }, + { + "include": "#comments-string-single-three" + } + ] + }, + "single-three-regexp-comments": { + "name": "comment.regexp", + "begin": "\\(\\?#", + "end": "(\\)|(?=\\'\\'\\'))", + "beginCaptures": { + "0": { + "name": "punctuation.comment.begin.regexp" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.comment.end.regexp" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#codetags" + } + ] + }, + "single-three-regexp-lookahead": { + "begin": "(\\()\\?=", + "end": "(\\)|(?=\\'\\'\\'))", + "beginCaptures": { + "0": { + "name": "keyword.operator.lookahead.regexp" + }, + "1": { + "name": "punctuation.parenthesis.lookahead.begin.regexp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#single-three-regexp-expression" + }, + { + "include": "#comments-string-single-three" + } + ] + }, + "single-three-regexp-lookahead-negative": { + "begin": "(\\()\\?!", + "end": "(\\)|(?=\\'\\'\\'))", + "beginCaptures": { + "0": { + "name": "keyword.operator.lookahead.negative.regexp" + }, + "1": { + "name": "punctuation.parenthesis.lookahead.begin.regexp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#single-three-regexp-expression" + }, + { + "include": "#comments-string-single-three" + } + ] + }, + "single-three-regexp-lookbehind": { + "begin": "(\\()\\?<=", + "end": "(\\)|(?=\\'\\'\\'))", + "beginCaptures": { + "0": { + "name": "keyword.operator.lookbehind.regexp" + }, + "1": { + "name": "punctuation.parenthesis.lookbehind.begin.regexp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#single-three-regexp-expression" + }, + { + "include": "#comments-string-single-three" + } + ] + }, + "single-three-regexp-lookbehind-negative": { + "begin": "(\\()\\?)\n", + "end": "(\\)|(?=\"))|((?=(?)\n", + "end": "(\\)|(?=\"\"\"))", + "beginCaptures": { + "1": { + "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp" + }, + "2": { + "name": "entity.name.tag.named.group.regexp" + } + }, + "endCaptures": { + "1": { + "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#double-three-regexp-expression" + }, + { + "include": "#comments-string-double-three" + } + ] + }, + "double-three-regexp-comments": { + "name": "comment.regexp", + "begin": "\\(\\?#", + "end": "(\\)|(?=\"\"\"))", + "beginCaptures": { + "0": { + "name": "punctuation.comment.begin.regexp" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.comment.end.regexp" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#codetags" + } + ] + }, + "double-three-regexp-lookahead": { + "begin": "(\\()\\?=", + "end": "(\\)|(?=\"\"\"))", + "beginCaptures": { + "0": { + "name": "keyword.operator.lookahead.regexp" + }, + "1": { + "name": "punctuation.parenthesis.lookahead.begin.regexp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#double-three-regexp-expression" + }, + { + "include": "#comments-string-double-three" + } + ] + }, + "double-three-regexp-lookahead-negative": { + "begin": "(\\()\\?!", + "end": "(\\)|(?=\"\"\"))", + "beginCaptures": { + "0": { + "name": "keyword.operator.lookahead.negative.regexp" + }, + "1": { + "name": "punctuation.parenthesis.lookahead.begin.regexp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#double-three-regexp-expression" + }, + { + "include": "#comments-string-double-three" + } + ] + }, + "double-three-regexp-lookbehind": { + "begin": "(\\()\\?<=", + "end": "(\\)|(?=\"\"\"))", + "beginCaptures": { + "0": { + "name": "keyword.operator.lookbehind.regexp" + }, + "1": { + "name": "punctuation.parenthesis.lookbehind.begin.regexp" + } + }, + "endCaptures": { + "1": { + "name": "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#double-three-regexp-expression" + }, + { + "include": "#comments-string-double-three" + } + ] + }, + "double-three-regexp-lookbehind-negative": { + "begin": "(\\()\\?=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )(?=})\n", + "captures": { + "1": { + "name": "storage.type.format.python" + }, + "2": { + "name": "storage.type.format.python" + } + } + }, + { + "include": "#fstring-terminator-single-tail" + } + ] + }, + "fstring-terminator-single-tail": { + "begin": "((?:=?)(?:![rsa])?)(:)(?=.*?{)", + "end": "(?=})|(?=\\n)", + "beginCaptures": { + "1": { + "name": "storage.type.format.python" + }, + "2": { + "name": "storage.type.format.python" + } + }, + "patterns": [ + { + "include": "#fstring-illegal-single-brace" + }, + { + "include": "#fstring-single-brace" + }, + { + "name": "storage.type.format.python", + "match": "([bcdeEfFgGnosxX%])(?=})" + }, + { + "name": "storage.type.format.python", + "match": "(\\.\\d+)" + }, + { + "name": "storage.type.format.python", + "match": "(,)" + }, + { + "name": "storage.type.format.python", + "match": "(\\d+)" + }, + { + "name": "storage.type.format.python", + "match": "(\\#)" + }, + { + "name": "storage.type.format.python", + "match": "([-+ ])" + }, + { + "name": "storage.type.format.python", + "match": "([<>=^])" + }, + { + "name": "storage.type.format.python", + "match": "(\\w)" + } + ] + }, + "fstring-fnorm-quoted-multi-line": { + "name": "meta.fstring.python", + "begin": "(\\b[fF])([bBuU])?('''|\"\"\")", + "end": "(\\3)", + "beginCaptures": { + "1": { + "name": "string.interpolated.python string.quoted.multi.python storage.type.string.python" + }, + "2": { + "name": "invalid.illegal.prefix.python" + }, + "3": { + "name": "punctuation.definition.string.begin.python string.interpolated.python string.quoted.multi.python" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.python string.interpolated.python string.quoted.multi.python" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#fstring-guts" + }, + { + "include": "#fstring-illegal-multi-brace" + }, + { + "include": "#fstring-multi-brace" + }, + { + "include": "#fstring-multi-core" + } + ] + }, + "fstring-normf-quoted-multi-line": { + "name": "meta.fstring.python", + "begin": "(\\b[bBuU])([fF])('''|\"\"\")", + "end": "(\\3)", + "beginCaptures": { + "1": { + "name": "invalid.illegal.prefix.python" + }, + "2": { + "name": "string.interpolated.python string.quoted.multi.python storage.type.string.python" + }, + "3": { + "name": "punctuation.definition.string.begin.python string.quoted.multi.python" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.python string.interpolated.python string.quoted.multi.python" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#fstring-guts" + }, + { + "include": "#fstring-illegal-multi-brace" + }, + { + "include": "#fstring-multi-brace" + }, + { + "include": "#fstring-multi-core" + } + ] + }, + "fstring-raw-quoted-multi-line": { + "name": "meta.fstring.python", + "begin": "(\\b(?:[rR][fF]|[fF][rR]))('''|\"\"\")", + "end": "(\\2)", + "beginCaptures": { + "1": { + "name": "string.interpolated.python string.quoted.raw.multi.python storage.type.string.python" + }, + "2": { + "name": "punctuation.definition.string.begin.python string.quoted.raw.multi.python" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.python string.interpolated.python string.quoted.raw.multi.python" + }, + "2": { + "name": "invalid.illegal.newline.python" + } + }, + "patterns": [ + { + "include": "#fstring-raw-guts" + }, + { + "include": "#fstring-illegal-multi-brace" + }, + { + "include": "#fstring-multi-brace" + }, + { + "include": "#fstring-raw-multi-core" + } + ] + }, + "fstring-multi-core": { + "name": "string.interpolated.python string.quoted.multi.python", + "match": "(?x)\n (.+?)\n (\n (?# .* and .*? in multi-line match need special handling of\n newlines otherwise SublimeText and Atom will match slightly\n differently.\n\n The guard for newlines has to be separate from the\n lookahead because of special $ matching rule.)\n ($\\n?)\n |\n (?=[\\\\\\}\\{]|'''|\"\"\")\n )\n (?# due to how multiline regexps are matched we need a special case\n for matching a newline character)\n | \\n\n" + }, + "fstring-raw-multi-core": { + "name": "string.interpolated.python string.quoted.raw.multi.python", + "match": "(?x)\n (.+?)\n (\n (?# .* and .*? in multi-line match need special handling of\n newlines otherwise SublimeText and Atom will match slightly\n differently.\n\n The guard for newlines has to be separate from the\n lookahead because of special $ matching rule.)\n ($\\n?)\n |\n (?=[\\\\\\}\\{]|'''|\"\"\")\n )\n (?# due to how multiline regexps are matched we need a special case\n for matching a newline character)\n | \\n\n" + }, + "fstring-multi-brace": { + "comment": "value interpolation using { ... }", + "begin": "(\\{)", + "end": "(?x)\n (\\})\n", + "beginCaptures": { + "1": { + "name": "constant.character.format.placeholder.other.python" + } + }, + "endCaptures": { + "1": { + "name": "constant.character.format.placeholder.other.python" + } + }, + "patterns": [ + { + "include": "#fstring-terminator-multi" + }, + { + "include": "#f-expression" + } + ] + }, + "fstring-terminator-multi": { + "patterns": [ + { + "name": "storage.type.format.python", + "match": "(=(![rsa])?)(?=})" + }, + { + "name": "storage.type.format.python", + "match": "(=?![rsa])(?=})" + }, + { + "match": "(?x)\n ( (?: =?) (?: ![rsa])? )\n ( : \\w? [<>=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )(?=})\n", + "captures": { + "1": { + "name": "storage.type.format.python" + }, + "2": { + "name": "storage.type.format.python" + } + } + }, + { + "include": "#fstring-terminator-multi-tail" + } + ] + }, + "fstring-terminator-multi-tail": { + "begin": "((?:=?)(?:![rsa])?)(:)(?=.*?{)", + "end": "(?=})", + "beginCaptures": { + "1": { + "name": "storage.type.format.python" + }, + "2": { + "name": "storage.type.format.python" + } + }, + "patterns": [ + { + "include": "#fstring-illegal-multi-brace" + }, + { + "include": "#fstring-multi-brace" + }, + { + "name": "storage.type.format.python", + "match": "([bcdeEfFgGnosxX%])(?=})" + }, + { + "name": "storage.type.format.python", + "match": "(\\.\\d+)" + }, + { + "name": "storage.type.format.python", + "match": "(,)" + }, + { + "name": "storage.type.format.python", + "match": "(\\d+)" + }, + { + "name": "storage.type.format.python", + "match": "(\\#)" + }, + { + "name": "storage.type.format.python", + "match": "([-+ ])" + }, + { + "name": "storage.type.format.python", + "match": "([<>=^])" + }, + { + "name": "storage.type.format.python", + "match": "(\\w)" + } + ] + } + } +} \ No newline at end of file diff --git a/language/syntaxes/test/injected-grammars/batchfile.tmLanguage.json b/language/syntaxes/test/injected-grammars/batchfile.tmLanguage.json new file mode 100644 index 00000000..85e03dbc --- /dev/null +++ b/language/syntaxes/test/injected-grammars/batchfile.tmLanguage.json @@ -0,0 +1,788 @@ +{ + "information_for_contributors": [ + "This file has been converted from https://github.com/mmims/language-batchfile/blob/master/grammars/batchfile.cson", + "If you want to provide a fix or improvement, please create a pull request against the original repository.", + "Once accepted there, we are happy to receive an update request." + ], + "version": "https://github.com/mmims/language-batchfile/commit/6154ae25a24e01ac9329e7bcf958e093cd8733a9", + "name": "Batch File", + "scopeName": "source.batchfile", + "injections": { + "L:meta.block.repeat.batchfile": { + "patterns": [ + { + "include": "#repeatParameter" + } + ] + } + }, + "patterns": [ + { + "include": "#commands" + }, + { + "include": "#comments" + }, + { + "include": "#constants" + }, + { + "include": "#controls" + }, + { + "include": "#escaped_characters" + }, + { + "include": "#labels" + }, + { + "include": "#numbers" + }, + { + "include": "#operators" + }, + { + "include": "#parens" + }, + { + "include": "#strings" + }, + { + "include": "#variables" + } + ], + "repository": { + "commands": { + "patterns": [ + { + "match": "(?<=^|[\\s@])(?i:adprep|append|arp|assoc|at|atmadm|attrib|auditpol|autochk|autoconv|autofmt|bcdboot|bcdedit|bdehdcfg|bitsadmin|bootcfg|brea|cacls|cd|certreq|certutil|change|chcp|chdir|chglogon|chgport|chgusr|chkdsk|chkntfs|choice|cipher|clip|cls|clscluadmin|cluster|cmd|cmdkey|cmstp|color|comp|compact|convert|copy|cprofile|cscript|csvde|date|dcdiag|dcgpofix|dcpromo|defra|del|dfscmd|dfsdiag|dfsrmig|diantz|dir|dirquota|diskcomp|diskcopy|diskpart|diskperf|diskraid|diskshadow|dispdiag|doin|dnscmd|doskey|driverquery|dsacls|dsadd|dsamain|dsdbutil|dsget|dsmgmt|dsmod|dsmove|dsquery|dsrm|edit|endlocal|eraseesentutl|eventcreate|eventquery|eventtriggers|evntcmd|expand|extract|fc|filescrn|find|findstr|finger|flattemp|fonde|forfiles|format|freedisk|fsutil|ftp|ftype|fveupdate|getmac|gettype|gpfixup|gpresult|gpupdate|graftabl|hashgen|hep|helpctr|hostname|icacls|iisreset|inuse|ipconfig|ipxroute|irftp|ismserv|jetpack|klist|ksetup|ktmutil|ktpass|label|ldifd|ldp|lodctr|logman|logoff|lpq|lpr|macfile|makecab|manage-bde|mapadmin|md|mkdir|mklink|mmc|mode|more|mount|mountvol|move|mqbup|mqsvc|mqtgsvc|msdt|msg|msiexec|msinfo32|mstsc|nbtstat|net computer|net group|net localgroup|net print|net session|net share|net start|net stop|net use|net user|net view|net|netcfg|netdiag|netdom|netsh|netstat|nfsadmin|nfsshare|nfsstat|nlb|nlbmgr|nltest|nslookup|ntackup|ntcmdprompt|ntdsutil|ntfrsutl|openfiles|pagefileconfig|path|pathping|pause|pbadmin|pentnt|perfmon|ping|pnpunatten|pnputil|popd|powercfg|powershell|powershell_ise|print|prncnfg|prndrvr|prnjobs|prnmngr|prnport|prnqctl|prompt|pubprn|pushd|pushprinterconnections|pwlauncher|qappsrv|qprocess|query|quser|qwinsta|rasdial|rcp|rd|rdpsign|regentc|recover|redircmp|redirusr|reg|regini|regsvr32|relog|ren|rename|rendom|repadmin|repair-bde|replace|reset session|rxec|risetup|rmdir|robocopy|route|rpcinfo|rpcping|rsh|runas|rundll32|rwinsta|sc|schtasks|scp|scwcmd|secedit|serverceipoptin|servrmanagercmd|serverweroptin|setspn|setx|sfc|sftp|shadow|shift|showmount|shutdown|sort|ssh|ssh-add|ssh-agent|ssh-keygen|ssh-keyscan|start|storrept|subst|sxstrace|ysocmgr|systeminfo|takeown|tapicfg|taskkill|tasklist|tcmsetup|telnet|tftp|time|timeout|title|tlntadmn|tpmvscmgr|tpmvscmgr|tacerpt|tracert|tree|tscon|tsdiscon|tsecimp|tskill|tsprof|type|typeperf|tzutil|uddiconfig|umount|unlodctr|ver|verifier|verif|vol|vssadmin|w32tm|waitfor|wbadmin|wdsutil|wecutil|wevtutil|where|whoami|winnt|winnt32|winpop|winrm|winrs|winsat|wlbs|wmic|wscript|wsl|xcopy)(?=$|\\s)", + "name": "keyword.command.batchfile" + }, + { + "begin": "(?i)(?<=^|[\\s@])(echo)(?:(?=$|\\.|:)|\\s+(?:(on|off)(?=\\s*$))?)", + "beginCaptures": { + "1": { + "name": "keyword.command.batchfile" + }, + "2": { + "name": "keyword.other.special-method.batchfile" + } + }, + "end": "(?=$\\n|[&|><)])", + "patterns": [ + { + "include": "#escaped_characters" + }, + { + "include": "#variables" + }, + { + "include": "#numbers" + }, + { + "include": "#strings" + } + ] + }, + { + "match": "(?i)(?<=^|[\\s@])(setlocal)(?:\\s*$|\\s+(EnableExtensions|DisableExtensions|EnableDelayedExpansion|DisableDelayedExpansion)(?=\\s*$))", + "captures": { + "1": { + "name": "keyword.command.batchfile" + }, + "2": { + "name": "keyword.other.special-method.batchfile" + } + } + }, + { + "include": "#command_set" + } + ] + }, + "command_set": { + "patterns": [ + { + "begin": "(?<=^|[\\s@])(?i:SET)(?=$|\\s)", + "beginCaptures": { + "0": { + "name": "keyword.command.batchfile" + } + }, + "end": "(?=$\\n|[&|><)])", + "patterns": [ + { + "include": "#command_set_inside" + } + ] + } + ] + }, + "command_set_inside": { + "patterns": [ + { + "include": "#escaped_characters" + }, + { + "include": "#variables" + }, + { + "include": "#numbers" + }, + { + "include": "#parens" + }, + { + "include": "#command_set_strings" + }, + { + "include": "#strings" + }, + { + "begin": "([^ ][^=]*)(=)", + "beginCaptures": { + "1": { + "name": "variable.other.readwrite.batchfile" + }, + "2": { + "name": "keyword.operator.assignment.batchfile" + } + }, + "end": "(?=$\\n|[&|><)])", + "patterns": [ + { + "include": "#escaped_characters" + }, + { + "include": "#variables" + }, + { + "include": "#numbers" + }, + { + "include": "#parens" + }, + { + "include": "#strings" + } + ] + }, + { + "begin": "\\s+/[aA]\\s+", + "end": "(?=$\\n|[&|><)])", + "name": "meta.expression.set.batchfile", + "patterns": [ + { + "begin": "\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.batchfile" + } + }, + "end": "\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.batchfile" + } + }, + "name": "string.quoted.double.batchfile", + "patterns": [ + { + "include": "#command_set_inside_arithmetic" + }, + { + "include": "#command_set_group" + }, + { + "include": "#variables" + } + ] + }, + { + "include": "#command_set_inside_arithmetic" + }, + { + "include": "#command_set_group" + } + ] + }, + { + "begin": "\\s+/[pP]\\s+", + "end": "(?=$\\n|[&|><)])", + "patterns": [ + { + "include": "#command_set_strings" + }, + { + "begin": "([^ ][^=]*)(=)", + "beginCaptures": { + "1": { + "name": "variable.other.readwrite.batchfile" + }, + "2": { + "name": "keyword.operator.assignment.batchfile" + } + }, + "end": "(?=$\\n|[&|><)])", + "name": "meta.prompt.set.batchfile", + "patterns": [ + { + "include": "#strings" + } + ] + } + ] + } + ] + }, + "command_set_group": { + "patterns": [ + { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.group.begin.batchfile" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.group.end.batchfile" + } + }, + "patterns": [ + { + "include": "#command_set_inside_arithmetic" + } + ] + } + ] + }, + "command_set_inside_arithmetic": { + "patterns": [ + { + "include": "#command_set_operators" + }, + { + "include": "#numbers" + }, + { + "match": ",", + "name": "punctuation.separator.batchfile" + } + ] + }, + "command_set_operators": { + "patterns": [ + { + "match": "([^ ]*)(\\+\\=|\\-\\=|\\*\\=|\\/\\=|%%\\=|&\\=|\\|\\=|\\^\\=|<<\\=|>>\\=)", + "captures": { + "1": { + "name": "variable.other.readwrite.batchfile" + }, + "2": { + "name": "keyword.operator.assignment.augmented.batchfile" + } + } + }, + { + "match": "\\+|\\-|/|\\*|%%|\\||&|\\^|<<|>>|~", + "name": "keyword.operator.arithmetic.batchfile" + }, + { + "match": "!", + "name": "keyword.operator.logical.batchfile" + }, + { + "match": "([^ =]*)(=)", + "captures": { + "1": { + "name": "variable.other.readwrite.batchfile" + }, + "2": { + "name": "keyword.operator.assignment.batchfile" + } + } + } + ] + }, + "command_set_strings": { + "patterns": [ + { + "begin": "(\")\\s*([^ ][^=]*)(=)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.string.begin.batchfile" + }, + "2": { + "name": "variable.other.readwrite.batchfile" + }, + "3": { + "name": "keyword.operator.assignment.batchfile" + } + }, + "end": "\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.batchfile" + } + }, + "name": "string.quoted.double.batchfile", + "patterns": [ + { + "include": "#variables" + }, + { + "include": "#numbers" + }, + { + "include": "#escaped_characters" + } + ] + } + ] + }, + "comments": { + "patterns": [ + { + "begin": "(?:^|(&))\\s*(?=((?::[+=,;: ])))", + "beginCaptures": { + "1": { + "name": "keyword.operator.conditional.batchfile" + } + }, + "end": "\\n", + "patterns": [ + { + "begin": "((?::[+=,;: ]))", + "beginCaptures": { + "1": { + "name": "punctuation.definition.comment.batchfile" + } + }, + "end": "(?=\\n)", + "name": "comment.line.colon.batchfile" + } + ] + }, + { + "begin": "(?<=^|[\\s@])(?i)(REM)(\\.)", + "beginCaptures": { + "1": { + "name": "keyword.command.rem.batchfile" + }, + "2": { + "name": "punctuation.separator.batchfile" + } + }, + "end": "(?=$\\n|[&|><)])", + "name": "comment.line.rem.batchfile" + }, + { + "begin": "(?<=^|[\\s@])(?i:rem)\\b", + "beginCaptures": { + "0": { + "name": "keyword.command.rem.batchfile" + } + }, + "end": "\\n", + "name": "comment.line.rem.batchfile", + "patterns": [ + { + "match": "[><|]", + "name": "invalid.illegal.unexpected-character.batchfile" + } + ] + } + ] + }, + "constants": { + "patterns": [ + { + "match": "\\b(?i:NUL)\\b", + "name": "constant.language.batchfile" + } + ] + }, + "controls": { + "patterns": [ + { + "match": "(?i)(?<=^|\\s)(?:call|exit(?=$|\\s)|goto(?=$|\\s|:))", + "name": "keyword.control.statement.batchfile" + }, + { + "match": "(?<=^|\\s)(?i)(if)\\s+(?:(not)\\s+)?(exist|defined|errorlevel|cmdextversion)(?=\\s)", + "captures": { + "1": { + "name": "keyword.control.conditional.batchfile" + }, + "2": { + "name": "keyword.operator.logical.batchfile" + }, + "3": { + "name": "keyword.other.special-method.batchfile" + } + } + }, + { + "match": "(?<=^|\\s)(?i)(?:if|else)(?=$|\\s)", + "name": "keyword.control.conditional.batchfile" + }, + { + "begin": "(?<=^|[\\s(&^])(?i)for(?=\\s)", + "beginCaptures": { + "0": { + "name": "keyword.control.repeat.batchfile" + } + }, + "name": "meta.block.repeat.batchfile", + "end": "\\n", + "patterns": [ + { + "begin": "(?<=[\\s^])(?i)in(?=\\s)", + "beginCaptures": { + "0": { + "name": "keyword.control.repeat.in.batchfile" + } + }, + "end": "(?<=[\\s)^])(?i)do(?=\\s)|\\n", + "endCaptures": { + "0": { + "name": "keyword.control.repeat.do.batchfile" + } + }, + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "include": "$self" + } + ] + } + ] + }, + "escaped_characters": { + "patterns": [ + { + "match": "%%|\\^\\^!|\\^(?=.)|\\^\\n", + "name": "constant.character.escape.batchfile" + } + ] + }, + "labels": { + "patterns": [ + { + "match": "(?i)(?:^\\s*|(?<=call|goto)\\s*)(:)([^+=,;:\\s]\\S*)", + "captures": { + "1": { + "name": "punctuation.separator.batchfile" + }, + "2": { + "name": "keyword.other.special-method.batchfile" + } + } + } + ] + }, + "numbers": { + "patterns": [ + { + "match": "(?<=^|\\s|=)(0[xX][0-9A-Fa-f]*|[+-]?\\d+)(?=$|\\s|<|>)", + "name": "constant.numeric.batchfile" + } + ] + }, + "operators": { + "patterns": [ + { + "match": "@(?=\\S)", + "name": "keyword.operator.at.batchfile" + }, + { + "match": "(?<=\\s)(?i:EQU|NEQ|LSS|LEQ|GTR|GEQ)(?=\\s)|==", + "name": "keyword.operator.comparison.batchfile" + }, + { + "match": "(?<=\\s)(?i)(NOT)(?=\\s)", + "name": "keyword.operator.logical.batchfile" + }, + { + "match": "(?[&>]?", + "name": "keyword.operator.redirection.batchfile" + } + ] + }, + "parens": { + "patterns": [ + { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.group.begin.batchfile" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.group.end.batchfile" + } + }, + "name": "meta.group.batchfile", + "patterns": [ + { + "match": ",|;", + "name": "punctuation.separator.batchfile" + }, + { + "include": "$self" + } + ] + } + ] + }, + "repeatParameter": { + "patterns": [ + { + "match": "(%%)(?:(?i:~[fdpnxsatz]*(?:\\$PATH:)?)?[a-zA-Z])", + "captures": { + "1": { + "name": "punctuation.definition.variable.batchfile" + } + }, + "name": "variable.parameter.repeat.batchfile" + } + ] + }, + "strings": { + "patterns": [ + { + "begin": "\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.batchfile" + } + }, + "end": "(\")|(\\n)", + "endCaptures": { + "1": { + "name": "punctuation.definition.string.end.batchfile" + }, + "2": { + "name": "invalid.illegal.newline.batchfile" + } + }, + "name": "string.quoted.double.batchfile", + "patterns": [ + { + "match": "%%", + "name": "constant.character.escape.batchfile" + }, + { + "include": "#variables" + } + ] + } + ] + }, + "variables": { + "patterns": [ + { + "match": "(%)(?:(?i:~[fdpnxsatz]*(?:\\$PATH:)?)?\\d|\\*)", + "captures": { + "1": { + "name": "punctuation.definition.variable.batchfile" + } + }, + "name": "variable.parameter.batchfile" + }, + { + "include": "#variable" + }, + { + "include": "#variable_delayed_expansion" + } + ] + }, + "variable": { + "patterns": [ + { + "begin": "%(?=[^%]+%)", + "beginCaptures": { + "0": { + "name": "punctuation.definition.variable.begin.batchfile" + } + }, + "end": "(%)|\\n", + "endCaptures": { + "1": { + "name": "punctuation.definition.variable.end.batchfile" + } + }, + "name": "variable.other.readwrite.batchfile", + "patterns": [ + { + "begin": ":~", + "beginCaptures": { + "0": { + "name": "punctuation.separator.batchfile" + } + }, + "end": "(?=%|\\n)", + "name": "meta.variable.substring.batchfile", + "patterns": [ + { + "include": "#variable_substring" + } + ] + }, + { + "begin": ":", + "beginCaptures": { + "0": { + "name": "punctuation.separator.batchfile" + } + }, + "end": "(?=%|\\n)", + "name": "meta.variable.substitution.batchfile", + "patterns": [ + { + "include": "#variable_replace" + }, + { + "begin": "=", + "beginCaptures": { + "0": { + "name": "punctuation.separator.batchfile" + } + }, + "end": "(?=%|\\n)", + "patterns": [ + { + "include": "#variable_delayed_expansion" + }, + { + "match": "[^%]+", + "name": "string.unquoted.batchfile" + } + ] + } + ] + } + ] + } + ] + }, + "variable_delayed_expansion": { + "patterns": [ + { + "begin": "!(?=[^!]+!)", + "beginCaptures": { + "0": { + "name": "punctuation.definition.variable.begin.batchfile" + } + }, + "end": "(!)|\\n", + "endCaptures": { + "1": { + "name": "punctuation.definition.variable.end.batchfile" + } + }, + "name": "variable.other.readwrite.batchfile", + "patterns": [ + { + "begin": ":~", + "beginCaptures": { + "0": { + "name": "punctuation.separator.batchfile" + } + }, + "end": "(?=!|\\n)", + "name": "meta.variable.substring.batchfile", + "patterns": [ + { + "include": "#variable_substring" + } + ] + }, + { + "begin": ":", + "beginCaptures": { + "0": { + "name": "punctuation.separator.batchfile" + } + }, + "end": "(?=!|\\n)", + "name": "meta.variable.substitution.batchfile", + "patterns": [ + { + "include": "#escaped_characters" + }, + { + "include": "#variable_replace" + }, + { + "include": "#variable" + }, + { + "begin": "=", + "beginCaptures": { + "0": { + "name": "punctuation.separator.batchfile" + } + }, + "end": "(?=!|\\n)", + "patterns": [ + { + "include": "#variable" + }, + { + "match": "[^!]+", + "name": "string.unquoted.batchfile" + } + ] + } + ] + } + ] + } + ] + }, + "variable_replace": { + "patterns": [ + { + "match": "[^=%!\\n]+", + "name": "string.unquoted.batchfile" + } + ] + }, + "variable_substring": { + "patterns": [ + { + "match": "([+-]?\\d+)(?:(,)([+-]?\\d+))?", + "captures": { + "1": { + "name": "constant.numeric.batchfile" + }, + "2": { + "name": "punctuation.separator.batchfile" + }, + "3": { + "name": "constant.numeric.batchfile" + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/language/syntaxes/test/injected-grammars/powershell.tmLanguage.json b/language/syntaxes/test/injected-grammars/powershell.tmLanguage.json new file mode 100644 index 00000000..e70dd530 --- /dev/null +++ b/language/syntaxes/test/injected-grammars/powershell.tmLanguage.json @@ -0,0 +1,1029 @@ +{ + "information_for_contributors": [ + "This file has been converted from https://github.com/PowerShell/EditorSyntax/blob/master/PowerShellSyntax.tmLanguage", + "If you want to provide a fix or improvement, please create a pull request against the original repository.", + "Once accepted there, we are happy to receive an update request." + ], + "version": "https://github.com/PowerShell/EditorSyntax/commit/742f0b5d4b60f5930c0b47fcc1f646860521296e", + "name": "PowerShell", + "scopeName": "source.powershell", + "patterns": [ + { + "begin": "<#", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.block.begin.powershell" + } + }, + "end": "#>", + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.block.end.powershell" + } + }, + "name": "comment.block.powershell", + "patterns": [ + { + "include": "#commentEmbeddedDocs" + } + ] + }, + { + "match": "[2-6]>&1|>>|>|<<|<|>|>\\||[1-6]>|[1-6]>>", + "name": "keyword.operator.redirection.powershell" + }, + { + "include": "#commands" + }, + { + "include": "#commentLine" + }, + { + "include": "#variable" + }, + { + "include": "#subexpression" + }, + { + "include": "#function" + }, + { + "include": "#attribute" + }, + { + "include": "#UsingDirective" + }, + { + "include": "#type" + }, + { + "include": "#hashtable" + }, + { + "include": "#doubleQuotedString" + }, + { + "include": "#scriptblock" + }, + { + "comment": "Needed to parse stuff correctly in 'argument mode'. (See about_parsing.)", + "include": "#doubleQuotedStringEscapes" + }, + { + "begin": "['\\x{2018}-\\x{201B}]", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.powershell" + } + }, + "end": "['\\x{2018}-\\x{201B}]", + "applyEndPatternLast": true, + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.powershell" + } + }, + "name": "string.quoted.single.powershell", + "patterns": [ + { + "match": "['\\x{2018}-\\x{201B}]{2}", + "name": "constant.character.escape.powershell" + } + ] + }, + { + "begin": "(@[\"\\x{201C}-\\x{201E}])\\s*$", + "beginCaptures": { + "1": { + "name": "punctuation.definition.string.begin.powershell" + } + }, + "end": "^[\"\\x{201C}-\\x{201E}]@", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.powershell" + } + }, + "name": "string.quoted.double.heredoc.powershell", + "patterns": [ + { + "include": "#variableNoProperty" + }, + { + "include": "#doubleQuotedStringEscapes" + }, + { + "include": "#interpolation" + } + ] + }, + { + "begin": "(@['\\x{2018}-\\x{201B}])\\s*$", + "beginCaptures": { + "1": { + "name": "punctuation.definition.string.begin.powershell" + } + }, + "end": "^['\\x{2018}-\\x{201B}]@", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.powershell" + } + }, + "name": "string.quoted.single.heredoc.powershell" + }, + { + "include": "#numericConstant" + }, + { + "begin": "(@)(\\()", + "beginCaptures": { + "1": { + "name": "keyword.other.array.begin.powershell" + }, + "2": { + "name": "punctuation.section.group.begin.powershell" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.group.end.powershell" + } + }, + "name": "meta.group.array-expression.powershell", + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "begin": "((\\$))(\\()", + "beginCaptures": { + "1": { + "name": "keyword.other.substatement.powershell" + }, + "2": { + "name": "punctuation.definition.subexpression.powershell" + }, + "3": { + "name": "punctuation.section.group.begin.powershell" + } + }, + "comment": "TODO: move to repo; make recursive.", + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.group.end.powershell" + } + }, + "name": "meta.group.complex.subexpression.powershell", + "patterns": [ + { + "include": "$self" + } + ] + }, + { + "match": "(\\b(([A-Za-z0-9\\-_\\.]+)\\.(?i:exe|com|cmd|bat))\\b)", + "name": "support.function.powershell" + }, + { + "match": "(?{1,5})}", + "name": "constant.character.escape.powershell" + }, + { + "match": "`u(?:\\{[0-9a-fA-F]{,6}.)?", + "name": "invalid.character.escape.powershell" + } + ] + }, + "function": { + "begin": "^(?:\\s*+)(?i)(function|filter|configuration|workflow)\\s+(?:(global|local|script|private):)?((?:\\p{L}|\\d|_|-|\\.)+)", + "beginCaptures": { + "0": { + "name": "meta.function.powershell" + }, + "1": { + "name": "storage.type.powershell" + }, + "2": { + "name": "storage.modifier.scope.powershell" + }, + "3": { + "name": "entity.name.function.powershell" + } + }, + "end": "(?=\\{|\\()", + "patterns": [ + { + "include": "#commentLine" + } + ] + }, + "subexpression": { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.group.begin.powershell" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.section.group.end.powershell" + } + }, + "name": "meta.group.simple.subexpression.powershell", + "patterns": [ + { + "include": "$self" + } + ] + }, + "interpolation": { + "begin": "(((\\$)))((\\())", + "beginCaptures": { + "1": { + "name": "keyword.other.substatement.powershell" + }, + "2": { + "name": "punctuation.definition.substatement.powershell" + }, + "3": { + "name": "punctuation.section.embedded.substatement.begin.powershell" + }, + "4": { + "name": "punctuation.section.group.begin.powershell" + }, + "5": { + "name": "punctuation.section.embedded.substatement.begin.powershell" + } + }, + "contentName": "interpolated.complex.source.powershell", + "end": "(\\))", + "endCaptures": { + "0": { + "name": "punctuation.section.group.end.powershell" + }, + "1": { + "name": "punctuation.section.embedded.substatement.end.powershell" + } + }, + "name": "meta.embedded.substatement.powershell", + "patterns": [ + { + "include": "$self" + } + ] + }, + "numericConstant": { + "patterns": [ + { + "captures": { + "1": { + "name": "constant.numeric.hex.powershell" + }, + "2": { + "name": "keyword.other.powershell" + } + }, + "match": "(?&;<>\\(\\)\\$`\\\\\"'<\\|]+)(?!>))", + "captures": { + "1": { + "name": "string.unquoted.argument.shell", + "patterns": [ + { + "match": "\\*", + "name": "variable.language.special.wildcard.shell" + }, + { + "include": "#variable" + }, + { + "include": "#numeric_literal" + }, + { + "match": "(?|#|\\n|$|;|[ \\t]))(?!nocorrect |nocorrect\t|nocorrect$|readonly |readonly\t|readonly$|function |function\t|function$|foreach |foreach\t|foreach$|coproc |coproc\t|coproc$|logout |logout\t|logout$|export |export\t|export$|select |select\t|select$|repeat |repeat\t|repeat$|pushd |pushd\t|pushd$|until |until\t|until$|while |while\t|while$|local |local\t|local$|case |case\t|case$|done |done\t|done$|elif |elif\t|elif$|else |else\t|else$|esac |esac\t|esac$|popd |popd\t|popd$|then |then\t|then$|time |time\t|time$|for |for\t|for$|end |end\t|end$|fi |fi\t|fi$|do |do\t|do$|in |in\t|in$|if |if\t|if$))(?:((?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$))|((?!\"|'|\\\\\\n?$)(?:[^!'\"<> \\t\\n\\r]+?)))(?:(?= |\\t)|(?:(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?]+))", + "captures": { + "1": { + "name": "entity.name.function.call.shell entity.name.command.shell" + } + } + }, + { + "begin": "(?:(?:\\G|(?|#|\\n|$|;|[ \\t]))(?!nocorrect |nocorrect\t|nocorrect$|readonly |readonly\t|readonly$|function |function\t|function$|foreach |foreach\t|foreach$|coproc |coproc\t|coproc$|logout |logout\t|logout$|export |export\t|export$|select |select\t|select$|repeat |repeat\t|repeat$|pushd |pushd\t|pushd$|until |until\t|until$|while |while\t|while$|local |local\t|local$|case |case\t|case$|done |done\t|done$|elif |elif\t|elif$|else |else\t|else$|esac |esac\t|esac$|popd |popd\t|popd$|then |then\t|then$|time |time\t|time$|for |for\t|for$|end |end\t|end$|fi |fi\t|fi$|do |do\t|do$|in |in\t|in$|if |if\t|if$)(?!\\\\\\n?$)))", + "end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?|&&|\\|\\|", + "name": "keyword.operator.logical.shell" + }, + { + "match": "(?[>=]?|==|!=|^|\\|{1,2}|&{1,2}|\\?|\\:|,|=|[*/%+\\-&^|]=|<<=|>>=", + "name": "keyword.operator.arithmetic.shell" + }, + { + "match": "0[xX][0-9A-Fa-f]+", + "name": "constant.numeric.hex.shell" + }, + { + "match": ";", + "name": "punctuation.separator.semicolon.range" + }, + { + "match": "0\\d+", + "name": "constant.numeric.octal.shell" + }, + { + "match": "\\d{1,2}#[0-9a-zA-Z@_]+", + "name": "constant.numeric.other.shell" + }, + { + "match": "\\d+", + "name": "constant.numeric.integer.shell" + }, + { + "match": "(?[>=]?|==|!=|^|\\|{1,2}|&{1,2}|\\?|\\:|,|=|[*/%+\\-&^|]=|<<=|>>=", + "name": "keyword.operator.arithmetic.shell" + }, + { + "match": "0[xX][0-9A-Fa-f]+", + "name": "constant.numeric.hex.shell" + }, + { + "match": "0\\d+", + "name": "constant.numeric.octal.shell" + }, + { + "match": "\\d{1,2}#[0-9a-zA-Z@_]+", + "name": "constant.numeric.other.shell" + }, + { + "match": "\\d+", + "name": "constant.numeric.integer.shell" + } + ] + }, + "misc_ranges": { + "patterns": [ + { + "include": "#logical_expression_single" + }, + { + "include": "#logical_expression_double" + }, + { + "include": "#subshell_dollar" + }, + { + "begin": "(?|#|\\n|$|;|[ \\t]))))", + "end": "(?:(?=[ \\t])|(?:(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?>?)(?:[ \\t]*+)([^ \t\n>&;<>\\(\\)\\$`\\\\\"'<\\|]+))", + "captures": { + "1": { + "name": "keyword.operator.redirect.shell" + }, + "2": { + "name": "string.unquoted.argument.shell" + } + } + }, + "redirect_number": { + "match": "(?<=[ \\t])(?:(?:(1)|(2)|(\\d+))(?=>))", + "captures": { + "1": { + "name": "keyword.operator.redirect.stdout.shell" + }, + "2": { + "name": "keyword.operator.redirect.stderr.shell" + }, + "3": { + "name": "keyword.operator.redirect.$3.shell" + } + } + }, + "redirection": { + "patterns": [ + { + "begin": "[><]\\(", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.shell" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.shell" + } + }, + "name": "string.interpolated.process-substitution.shell", + "patterns": [ + { + "include": "#initial_context" + } + ] + }, + { + "match": "(?])(&>|\\d*>&\\d*|\\d*(>>|>|<)|\\d*<&|\\d*<>)(?![<>])", + "name": "keyword.operator.redirect.shell" + } + ] + }, + "regex_comparison": { + "match": "\\=~", + "name": "keyword.operator.logical.regex.shell" + }, + "regexp": { + "patterns": [ + { + "match": "(?:.+)" + } + ] + }, + "simple_options": { + "match": "(?:(?:[ \\t]++)\\-(?:\\w+))*", + "captures": { + "0": { + "patterns": [ + { + "match": "(?:[ \\t]++)(\\-)(\\w+)", + "captures": { + "1": { + "name": "string.unquoted.argument.shell constant.other.option.dash.shell" + }, + "2": { + "name": "string.unquoted.argument.shell constant.other.option.shell" + } + } + } + ] + } + } + }, + "simple_unquoted": { + "match": "[^ \\t\\n>&;<>\\(\\)\\$`\\\\\"'<\\|]", + "name": "string.unquoted.shell" + }, + "special_expansion": { + "match": "!|:[-=?]?|\\*|@|##|#|%%|%|\\/", + "name": "keyword.operator.expansion.shell" + }, + "start_of_command": { + "match": "(?:(?:[ \\t]*+)(?:(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?!nocorrect |nocorrect\t|nocorrect$|readonly |readonly\t|readonly$|function |function\t|function$|foreach |foreach\t|foreach$|coproc |coproc\t|coproc$|logout |logout\t|logout$|export |export\t|export$|select |select\t|select$|repeat |repeat\t|repeat$|pushd |pushd\t|pushd$|until |until\t|until$|while |while\t|while$|local |local\t|local$|case |case\t|case$|done |done\t|done$|elif |elif\t|elif$|else |else\t|else$|esac |esac\t|esac$|popd |popd\t|popd$|then |then\t|then$|time |time\t|time$|for |for\t|for$|end |end\t|end$|fi |fi\t|fi$|do |do\t|do$|in |in\t|in$|if |if\t|if$)(?!\\\\\\n?$)))" + }, + "string": { + "patterns": [ + { + "match": "\\\\.", + "name": "constant.character.escape.shell" + }, + { + "begin": "'", + "end": "'", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.shell" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.shell" + } + }, + "name": "string.quoted.single.shell" + }, + { + "begin": "\\$?\"", + "end": "\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.shell" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.shell" + } + }, + "name": "string.quoted.double.shell", + "patterns": [ + { + "match": "\\\\[\\$\\n`\"\\\\]", + "name": "constant.character.escape.shell" + }, + { + "include": "#variable" + }, + { + "include": "#interpolation" + } + ] + }, + { + "begin": "\\$'", + "end": "'", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.shell" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.shell" + } + }, + "name": "string.quoted.single.dollar.shell", + "patterns": [ + { + "match": "\\\\(?:a|b|e|f|n|r|t|v|\\\\|')", + "name": "constant.character.escape.ansi-c.shell" + }, + { + "match": "\\\\[0-9]{3}\"", + "name": "constant.character.escape.octal.shell" + }, + { + "match": "\\\\x[0-9a-fA-F]{2}\"", + "name": "constant.character.escape.hex.shell" + }, + { + "match": "\\\\c.\"", + "name": "constant.character.escape.control-char.shell" + } + ] + } + ] + }, + "subshell_dollar": { + "patterns": [ + { + "begin": "(?:\\$\\()", + "end": "\\)", + "beginCaptures": { + "0": { + "name": "punctuation.definition.subshell.single.shell" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.definition.subshell.single.shell" + } + }, + "name": "meta.scope.subshell", + "patterns": [ + { + "include": "#parenthese" + }, + { + "include": "#initial_context" + } + ] + } + ] + }, + "support": { + "patterns": [ + { + "match": "(?<=^|;|&|\\s)(?::|\\.)(?=\\s|;|&|$)", + "name": "support.function.builtin.shell" + } + ] + }, + "typical_statements": { + "patterns": [ + { + "include": "#assignment_statement" + }, + { + "include": "#case_statement" + }, + { + "include": "#for_statement" + }, + { + "include": "#while_statement" + }, + { + "include": "#function_definition" + }, + { + "include": "#command_statement" + }, + { + "include": "#line_continuation" + }, + { + "include": "#arithmetic_double" + }, + { + "include": "#normal_context" + } + ] + }, + "variable": { + "patterns": [ + { + "match": "(?:(\\$)(\\@(?!\\w)))", + "captures": { + "1": { + "name": "punctuation.definition.variable.shell variable.parameter.positional.all.shell" + }, + "2": { + "name": "variable.parameter.positional.all.shell" + } + } + }, + { + "match": "(?:(\\$)([0-9](?!\\w)))", + "captures": { + "1": { + "name": "punctuation.definition.variable.shell variable.parameter.positional.shell" + }, + "2": { + "name": "variable.parameter.positional.shell" + } + } + }, + { + "match": "(?:(\\$)([-*#?$!0_](?!\\w)))", + "captures": { + "1": { + "name": "punctuation.definition.variable.shell variable.language.special.shell" + }, + "2": { + "name": "variable.language.special.shell" + } + } + }, + { + "begin": "(?:(\\$)(\\{)(?:[ \\t]*+)(?=\\d))", + "end": "\\}", + "beginCaptures": { + "1": { + "name": "punctuation.definition.variable.shell variable.parameter.positional.shell" + }, + "2": { + "name": "punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell variable.parameter.positional.shell" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell variable.parameter.positional.shell" + } + }, + "contentName": "meta.parameter-expansion", + "patterns": [ + { + "include": "#special_expansion" + }, + { + "include": "#array_access_inline" + }, + { + "match": "[0-9]+", + "name": "variable.parameter.positional.shell" + }, + { + "match": "(?= 16", + "node": ">= 22", "vscode": "^1.72.0" } }, @@ -3001,6 +3002,12 @@ "integrity": "sha512-Nik3Sc0ncrMK4UUdXQmAnRtzmNQTAAXmXIopizwZ1W1t8QmfJj+zL4OA2I7XPTPW5z5TDqv4hRo/JzouDJnX3A==", "license": "Apache-2.0" }, + "node_modules/better-result": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/better-result/-/better-result-2.9.2.tgz", + "integrity": "sha512-WIFoBPCdnTOdk9inkE1ZRvCZ4P0CpSkAiLlchC65N7n9DcjZ3NhqkBOlafzpOVnO8ixyi37kicmSJ3ENhPZl7Q==", + "dev": true + }, "node_modules/bn.js": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.2.tgz", @@ -7856,6 +7863,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/minipass": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz", + "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==", + "dev": true, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/mkdirp-classic": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", @@ -8255,6 +8271,31 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, + "node_modules/path-scurry": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz", + "integrity": "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==", + "dev": true, + "dependencies": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "11.5.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.2.tgz", + "integrity": "sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g==", + "dev": true, + "engines": { + "node": "20 || >=22" + } + }, "node_modules/path-to-regexp": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", @@ -9559,6 +9600,101 @@ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, + "node_modules/textmate-grammar-test": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/textmate-grammar-test/-/textmate-grammar-test-0.7.0.tgz", + "integrity": "sha512-sb+Xbms+xLgZt/OKsMvQhZr3aP5itHduE7+IjaJ4Opc203S6VvJEEmG3R4Zy+DPwX3tpjCZoYKFd0mUSFfzZ/g==", + "dev": true, + "dependencies": { + "better-result": "~2.9.2", + "chalk": "~5.6.2", + "commander": "~14.0.3", + "glob": "~13.0.6", + "vscode-oniguruma": "~2.0.1", + "vscode-textmate": "~9.3.2" + }, + "bin": { + "textmate-grammar-snap": "dist/snapshot.js", + "textmate-grammar-test": "dist/unit.js" + }, + "engines": { + "node": ">=22" + } + }, + "node_modules/textmate-grammar-test/node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/textmate-grammar-test/node_modules/brace-expansion": { + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz", + "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==", + "dev": true, + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/textmate-grammar-test/node_modules/chalk": { + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", + "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/textmate-grammar-test/node_modules/commander": { + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.3.tgz", + "integrity": "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==", + "dev": true, + "engines": { + "node": ">=20" + } + }, + "node_modules/textmate-grammar-test/node_modules/glob": { + "version": "13.0.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.6.tgz", + "integrity": "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==", + "dev": true, + "dependencies": { + "minimatch": "^10.2.2", + "minipass": "^7.1.3", + "path-scurry": "^2.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/textmate-grammar-test/node_modules/minimatch": { + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", + "dev": true, + "dependencies": { + "brace-expansion": "^5.0.8" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/through2": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", @@ -10183,6 +10319,18 @@ "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.2.tgz", "integrity": "sha512-zHhCWatviizPIq9B7Vh9uvrH6x3sK8itC84HkamnBWoDFJtzBf7SWlpLCZUit72b3os45h6RWQNC9xHRDF8dRA==" }, + "node_modules/vscode-oniguruma": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-2.0.1.tgz", + "integrity": "sha512-poJU8iHIWnC3vgphJnrLZyI3YdqRlR27xzqDmpPXYzA93R4Gk8z7T6oqDzDoHjoikA2aS82crdXFkjELCdJsjQ==", + "dev": true + }, + "node_modules/vscode-textmate": { + "version": "9.3.2", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-9.3.2.tgz", + "integrity": "sha512-n2uGbUcrjhUEBH16uGA0TvUfhWwliFZ1e3+pTjrkim1Mt7ydB41lV08aUvsi70OlzDWp6X7Bx3w/x3fAXIsN0Q==", + "dev": true + }, "node_modules/vscode-uri": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.1.0.tgz", @@ -12822,6 +12970,12 @@ "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-3.0.2.tgz", "integrity": "sha512-Nik3Sc0ncrMK4UUdXQmAnRtzmNQTAAXmXIopizwZ1W1t8QmfJj+zL4OA2I7XPTPW5z5TDqv4hRo/JzouDJnX3A==" }, + "better-result": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/better-result/-/better-result-2.9.2.tgz", + "integrity": "sha512-WIFoBPCdnTOdk9inkE1ZRvCZ4P0CpSkAiLlchC65N7n9DcjZ3NhqkBOlafzpOVnO8ixyi37kicmSJ3ENhPZl7Q==", + "dev": true + }, "bn.js": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.2.tgz", @@ -16413,6 +16567,12 @@ "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", "devOptional": true }, + "minipass": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz", + "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==", + "dev": true + }, "mkdirp-classic": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", @@ -16723,6 +16883,24 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, + "path-scurry": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz", + "integrity": "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==", + "dev": true, + "requires": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "dependencies": { + "lru-cache": { + "version": "11.5.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.2.tgz", + "integrity": "sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g==", + "dev": true + } + } + }, "path-to-regexp": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", @@ -17663,6 +17841,69 @@ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, + "textmate-grammar-test": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/textmate-grammar-test/-/textmate-grammar-test-0.7.0.tgz", + "integrity": "sha512-sb+Xbms+xLgZt/OKsMvQhZr3aP5itHduE7+IjaJ4Opc203S6VvJEEmG3R4Zy+DPwX3tpjCZoYKFd0mUSFfzZ/g==", + "dev": true, + "requires": { + "better-result": "~2.9.2", + "chalk": "~5.6.2", + "commander": "~14.0.3", + "glob": "~13.0.6", + "vscode-oniguruma": "~2.0.1", + "vscode-textmate": "~9.3.2" + }, + "dependencies": { + "balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true + }, + "brace-expansion": { + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz", + "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==", + "dev": true, + "requires": { + "balanced-match": "^4.0.2" + } + }, + "chalk": { + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", + "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", + "dev": true + }, + "commander": { + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.3.tgz", + "integrity": "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==", + "dev": true + }, + "glob": { + "version": "13.0.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.6.tgz", + "integrity": "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==", + "dev": true, + "requires": { + "minimatch": "^10.2.2", + "minipass": "^7.1.3", + "path-scurry": "^2.0.2" + } + }, + "minimatch": { + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", + "dev": true, + "requires": { + "brace-expansion": "^5.0.8" + } + } + } + }, "through2": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", @@ -18088,6 +18329,18 @@ "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.2.tgz", "integrity": "sha512-zHhCWatviizPIq9B7Vh9uvrH6x3sK8itC84HkamnBWoDFJtzBf7SWlpLCZUit72b3os45h6RWQNC9xHRDF8dRA==" }, + "vscode-oniguruma": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-2.0.1.tgz", + "integrity": "sha512-poJU8iHIWnC3vgphJnrLZyI3YdqRlR27xzqDmpPXYzA93R4Gk8z7T6oqDzDoHjoikA2aS82crdXFkjELCdJsjQ==", + "dev": true + }, + "vscode-textmate": { + "version": "9.3.2", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-9.3.2.tgz", + "integrity": "sha512-n2uGbUcrjhUEBH16uGA0TvUfhWwliFZ1e3+pTjrkim1Mt7ydB41lV08aUvsi70OlzDWp6X7Bx3w/x3fAXIsN0Q==", + "dev": true + }, "vscode-uri": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.1.0.tgz", diff --git a/package.json b/package.json index 99d7915e..4acb70d3 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "version": "0.32.3", "engines": { "vscode": "^1.72.0", - "node": ">= 16" + "node": ">= 22" }, "extensionKind": [ "workspace" @@ -65,8 +65,8 @@ ] }, { - "scopeName": "source.github-actions-workflow.actions-script", - "path": "./language/syntaxes/actions-script.tmGrammar.json", + "scopeName": "source.github-actions-workflow.actions-github-script", + "path": "./language/syntaxes/actions-github-script.tmGrammar.json", "injectTo": [ "source.github-actions-workflow" ], @@ -579,7 +579,9 @@ "format-check": "prettier --check \"**/*.ts\"", "test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest", "test-watch": "NODE_OPTIONS=\"--experimental-vm-modules\" jest --watch", - "grammars-generate": "node ./script/grammars/generate.mjs" + "grammars-generate": "node ./script/grammars/generate.mjs", + "grammars-test": "textmate-grammar-snap -s source.github-actions-workflow -g \"language/syntaxes/test/injected-grammars/*.tmLanguage.json\" \"language/syntaxes/test/**/*.test.yml\"", + "grammars-test-update": "npm run grammars-test -- -u" }, "devDependencies": { "@types/jest": "^29.0.3", @@ -599,6 +601,7 @@ "prettier": "^2.8.3", "rimraf": "^3.0.1", "source-map-loader": "^4.0.1", + "textmate-grammar-test": "^0.7.0", "ts-jest": "^29.0.3", "ts-loader": "^9.4.1", "typescript": "^4.9.4", From 0c5deef82d0e28b33a8dd323f3a95613d27eca4c Mon Sep 17 00:00:00 2001 From: reduckted Date: Sun, 16 Aug 2026 19:42:19 +1000 Subject: [PATCH 6/9] Fixed bug in expressions grammar where `null`, `true` and `false` were treated as context values. --- language/syntaxes/expressions.tmGrammar.json | 12 ++++++------ .../test/expressions/expression-all.test.yml.snap | 4 ++-- .../expressions/expression-boolean.test.yml.snap | 4 ++-- .../test/expressions/expression-null.test.yml.snap | 4 ++-- .../syntaxes/test/expressions/if-all.test.yml.snap | 4 ++-- .../test/expressions/if-boolean.test.yml.snap | 4 ++-- .../syntaxes/test/expressions/if-null.test.yml.snap | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/language/syntaxes/expressions.tmGrammar.json b/language/syntaxes/expressions.tmGrammar.json index 6e4fe280..bbae9ae3 100644 --- a/language/syntaxes/expressions.tmGrammar.json +++ b/language/syntaxes/expressions.tmGrammar.json @@ -19,9 +19,6 @@ { "include": "#function-call" }, - { - "include": "#context" - }, { "include": "#string" }, @@ -33,6 +30,9 @@ }, { "include": "#null" + }, + { + "include": "#context" } ] } @@ -54,9 +54,6 @@ { "include": "#function-call" }, - { - "include": "#context" - }, { "include": "#string" }, @@ -68,6 +65,9 @@ }, { "include": "#null" + }, + { + "include": "#context" } ] } diff --git a/language/syntaxes/test/expressions/expression-all.test.yml.snap b/language/syntaxes/test/expressions/expression-all.test.yml.snap index e7107188..74e82fe7 100644 --- a/language/syntaxes/test/expressions/expression-all.test.yml.snap +++ b/language/syntaxes/test/expressions/expression-all.test.yml.snap @@ -65,9 +65,9 @@ # ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression # ^^ source.github-actions-workflow meta.embedded.block.github-actions-expression constant.numeric.github-actions-expression # ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression -# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression constant.language.boolean.github-actions-expression # ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression -# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression constant.language.null.github-actions-expression # ^ source.github-actions-workflow meta.embedded.block.github-actions-expression # ^^ source.github-actions-workflow meta.embedded.block.github-actions-expression > uses: foo/bar@main diff --git a/language/syntaxes/test/expressions/expression-boolean.test.yml.snap b/language/syntaxes/test/expressions/expression-boolean.test.yml.snap index 02f3e0e4..f1aa7131 100644 --- a/language/syntaxes/test/expressions/expression-boolean.test.yml.snap +++ b/language/syntaxes/test/expressions/expression-boolean.test.yml.snap @@ -52,9 +52,9 @@ # ^ source.github-actions-workflow # ^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression # ^ source.github-actions-workflow meta.embedded.block.github-actions-expression -# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression constant.language.boolean.github-actions-expression # ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression -# ^^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression constant.language.boolean.github-actions-expression # ^ source.github-actions-workflow meta.embedded.block.github-actions-expression # ^^ source.github-actions-workflow meta.embedded.block.github-actions-expression > uses: foo/bar@main diff --git a/language/syntaxes/test/expressions/expression-null.test.yml.snap b/language/syntaxes/test/expressions/expression-null.test.yml.snap index 5054a8a8..e45267ab 100644 --- a/language/syntaxes/test/expressions/expression-null.test.yml.snap +++ b/language/syntaxes/test/expressions/expression-null.test.yml.snap @@ -52,9 +52,9 @@ # ^ source.github-actions-workflow # ^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression # ^ source.github-actions-workflow meta.embedded.block.github-actions-expression -# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression constant.language.null.github-actions-expression # ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression -# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^^^^ source.github-actions-workflow meta.embedded.block.github-actions-expression constant.language.null.github-actions-expression # ^ source.github-actions-workflow meta.embedded.block.github-actions-expression # ^^ source.github-actions-workflow meta.embedded.block.github-actions-expression > uses: foo/bar@main diff --git a/language/syntaxes/test/expressions/if-all.test.yml.snap b/language/syntaxes/test/expressions/if-all.test.yml.snap index d9110e57..bb207a87 100644 --- a/language/syntaxes/test/expressions/if-all.test.yml.snap +++ b/language/syntaxes/test/expressions/if-all.test.yml.snap @@ -71,9 +71,9 @@ # ^^^^ source.github-actions-workflow # ^^ source.github-actions-workflow constant.numeric.github-actions-expression # ^^^^ source.github-actions-workflow -# ^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +# ^^^^ source.github-actions-workflow constant.language.boolean.github-actions-expression # ^^^^ source.github-actions-workflow -# ^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +# ^^^^ source.github-actions-workflow constant.language.null.github-actions-expression > uses: foo/bar@main #^^^^^^^^ source.github-actions-workflow # ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml diff --git a/language/syntaxes/test/expressions/if-boolean.test.yml.snap b/language/syntaxes/test/expressions/if-boolean.test.yml.snap index d48d5442..16b194aa 100644 --- a/language/syntaxes/test/expressions/if-boolean.test.yml.snap +++ b/language/syntaxes/test/expressions/if-boolean.test.yml.snap @@ -58,9 +58,9 @@ # ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml # ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml # ^ source.github-actions-workflow -# ^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +# ^^^^ source.github-actions-workflow constant.language.boolean.github-actions-expression # ^^^^ source.github-actions-workflow -# ^^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +# ^^^^^ source.github-actions-workflow constant.language.boolean.github-actions-expression > uses: foo/bar@main #^^^^^^^^ source.github-actions-workflow # ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml diff --git a/language/syntaxes/test/expressions/if-null.test.yml.snap b/language/syntaxes/test/expressions/if-null.test.yml.snap index 429e68e2..79874fc4 100644 --- a/language/syntaxes/test/expressions/if-null.test.yml.snap +++ b/language/syntaxes/test/expressions/if-null.test.yml.snap @@ -58,9 +58,9 @@ # ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml # ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml # ^ source.github-actions-workflow -# ^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +# ^^^^ source.github-actions-workflow constant.language.null.github-actions-expression # ^^^^ source.github-actions-workflow -# ^^^^ source.github-actions-workflow variable.other.read.github-actions-expression +# ^^^^ source.github-actions-workflow constant.language.null.github-actions-expression > uses: foo/bar@main #^^^^^^^^ source.github-actions-workflow # ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml From 95ac7738d4ccbd38cd9d0974dc483da213ca8243 Mon Sep 17 00:00:00 2001 From: reduckted Date: Wed, 12 Aug 2026 13:26:19 +1000 Subject: [PATCH 7/9] Added tests for the `actions/github-script` grammar. --- .../blank-lines-between-properties.test.yml | 19 +++ ...ank-lines-between-properties.test.yml.snap | 89 +++++++++++++ .../blank-lines-in-block.test.yml | 21 +++ .../blank-lines-in-block.test.yml.snap | 100 ++++++++++++++ .../test/actions-github-script/block.test.yml | 18 +++ .../actions-github-script/block.test.yml.snap | 94 +++++++++++++ .../comment-after-script.test.yml | 23 ++++ .../comment-after-script.test.yml.snap | 120 +++++++++++++++++ .../comments-after-properties.test.yml | 17 +++ .../comments-after-properties.test.yml.snap | 91 +++++++++++++ .../comments-between-properties.test.yml | 19 +++ .../comments-between-properties.test.yml.snap | 93 +++++++++++++ .../composite-action.test.yml | 13 ++ .../composite-action.test.yml.snap | 82 ++++++++++++ .../expression-in-script.test.yml | 18 +++ .../expression-in-script.test.yml.snap | 102 +++++++++++++++ .../input-after-script-block.test.yml | 18 +++ .../input-after-script-block.test.yml.snap | 92 +++++++++++++ .../input-after-script-plain.test.yml | 17 +++ .../input-after-script-plain.test.yml.snap | 89 +++++++++++++ .../input-before-script.test.yml | 18 +++ .../input-before-script.test.yml.snap | 92 +++++++++++++ .../not-actions-github-script.test.yml | 17 +++ .../not-actions-github-script.test.yml.snap | 81 ++++++++++++ .../parallel-steps.test.yml | 22 ++++ .../parallel-steps.test.yml.snap | 123 ++++++++++++++++++ .../plain-single-line.test.yml | 16 +++ .../plain-single-line.test.yml.snap | 82 ++++++++++++ .../plain-wrapped.test.yml | 18 +++ .../plain-wrapped.test.yml.snap | 94 +++++++++++++ .../step-after-script.test.yml | 20 +++ .../step-after-script.test.yml.snap | 106 +++++++++++++++ .../uses-as-first-property.test.yml | 16 +++ .../uses-as-first-property.test.yml.snap | 80 ++++++++++++ 34 files changed, 1920 insertions(+) create mode 100644 language/syntaxes/test/actions-github-script/blank-lines-between-properties.test.yml create mode 100644 language/syntaxes/test/actions-github-script/blank-lines-between-properties.test.yml.snap create mode 100644 language/syntaxes/test/actions-github-script/blank-lines-in-block.test.yml create mode 100644 language/syntaxes/test/actions-github-script/blank-lines-in-block.test.yml.snap create mode 100644 language/syntaxes/test/actions-github-script/block.test.yml create mode 100644 language/syntaxes/test/actions-github-script/block.test.yml.snap create mode 100644 language/syntaxes/test/actions-github-script/comment-after-script.test.yml create mode 100644 language/syntaxes/test/actions-github-script/comment-after-script.test.yml.snap create mode 100644 language/syntaxes/test/actions-github-script/comments-after-properties.test.yml create mode 100644 language/syntaxes/test/actions-github-script/comments-after-properties.test.yml.snap create mode 100644 language/syntaxes/test/actions-github-script/comments-between-properties.test.yml create mode 100644 language/syntaxes/test/actions-github-script/comments-between-properties.test.yml.snap create mode 100644 language/syntaxes/test/actions-github-script/composite-action.test.yml create mode 100644 language/syntaxes/test/actions-github-script/composite-action.test.yml.snap create mode 100644 language/syntaxes/test/actions-github-script/expression-in-script.test.yml create mode 100644 language/syntaxes/test/actions-github-script/expression-in-script.test.yml.snap create mode 100644 language/syntaxes/test/actions-github-script/input-after-script-block.test.yml create mode 100644 language/syntaxes/test/actions-github-script/input-after-script-block.test.yml.snap create mode 100644 language/syntaxes/test/actions-github-script/input-after-script-plain.test.yml create mode 100644 language/syntaxes/test/actions-github-script/input-after-script-plain.test.yml.snap create mode 100644 language/syntaxes/test/actions-github-script/input-before-script.test.yml create mode 100644 language/syntaxes/test/actions-github-script/input-before-script.test.yml.snap create mode 100644 language/syntaxes/test/actions-github-script/not-actions-github-script.test.yml create mode 100644 language/syntaxes/test/actions-github-script/not-actions-github-script.test.yml.snap create mode 100644 language/syntaxes/test/actions-github-script/parallel-steps.test.yml create mode 100644 language/syntaxes/test/actions-github-script/parallel-steps.test.yml.snap create mode 100644 language/syntaxes/test/actions-github-script/plain-single-line.test.yml create mode 100644 language/syntaxes/test/actions-github-script/plain-single-line.test.yml.snap create mode 100644 language/syntaxes/test/actions-github-script/plain-wrapped.test.yml create mode 100644 language/syntaxes/test/actions-github-script/plain-wrapped.test.yml.snap create mode 100644 language/syntaxes/test/actions-github-script/step-after-script.test.yml create mode 100644 language/syntaxes/test/actions-github-script/step-after-script.test.yml.snap create mode 100644 language/syntaxes/test/actions-github-script/uses-as-first-property.test.yml create mode 100644 language/syntaxes/test/actions-github-script/uses-as-first-property.test.yml.snap diff --git a/language/syntaxes/test/actions-github-script/blank-lines-between-properties.test.yml b/language/syntaxes/test/actions-github-script/blank-lines-between-properties.test.yml new file mode 100644 index 00000000..6901b62c --- /dev/null +++ b/language/syntaxes/test/actions-github-script/blank-lines-between-properties.test.yml @@ -0,0 +1,19 @@ +# SYNTAX TEST "source.github-actions-workflow" "blank lines between properties" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Step + uses: actions/github-script@v9 + + with: + + script: | + console.log("Hello"); diff --git a/language/syntaxes/test/actions-github-script/blank-lines-between-properties.test.yml.snap b/language/syntaxes/test/actions-github-script/blank-lines-between-properties.test.yml.snap new file mode 100644 index 00000000..15913b0e --- /dev/null +++ b/language/syntaxes/test/actions-github-script/blank-lines-between-properties.test.yml.snap @@ -0,0 +1,89 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "blank lines between properties" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> uses: actions/github-script@v9 +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> with: +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +> script: | +#^^^^^^^^^^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> console.log("Hello"); +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.begin.js +# ^^^^^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.end.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.terminator.statement.js +> +#^ source.github-actions-workflow meta.embedded.inline.javascript diff --git a/language/syntaxes/test/actions-github-script/blank-lines-in-block.test.yml b/language/syntaxes/test/actions-github-script/blank-lines-in-block.test.yml new file mode 100644 index 00000000..c70e34ec --- /dev/null +++ b/language/syntaxes/test/actions-github-script/blank-lines-in-block.test.yml @@ -0,0 +1,21 @@ +# SYNTAX TEST "source.github-actions-workflow" "block scalar script with blank lines" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Step + uses: actions/github-script@v9 + with: + script: | + + console.log("Hello"); + + process.exit(1); + diff --git a/language/syntaxes/test/actions-github-script/blank-lines-in-block.test.yml.snap b/language/syntaxes/test/actions-github-script/blank-lines-in-block.test.yml.snap new file mode 100644 index 00000000..ba5898c6 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/blank-lines-in-block.test.yml.snap @@ -0,0 +1,100 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "block scalar script with blank lines" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> uses: actions/github-script@v9 +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> with: +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> script: | +#^^^^^^^^^^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> +#^ source.github-actions-workflow +> console.log("Hello"); +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.begin.js +# ^^^^^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.end.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.terminator.statement.js +> +#^ source.github-actions-workflow meta.embedded.inline.javascript +> process.exit(1); +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript constant.numeric.decimal.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.terminator.statement.js +> +#^ source.github-actions-workflow meta.embedded.inline.javascript +> +#^ source.github-actions-workflow meta.embedded.inline.javascript diff --git a/language/syntaxes/test/actions-github-script/block.test.yml b/language/syntaxes/test/actions-github-script/block.test.yml new file mode 100644 index 00000000..8f387e40 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/block.test.yml @@ -0,0 +1,18 @@ +# SYNTAX TEST "source.github-actions-workflow" "block scalar script" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Step + uses: actions/github-script@v9 + with: + script: | + console.log("Hello"); + process.exit(1); diff --git a/language/syntaxes/test/actions-github-script/block.test.yml.snap b/language/syntaxes/test/actions-github-script/block.test.yml.snap new file mode 100644 index 00000000..12a6fb57 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/block.test.yml.snap @@ -0,0 +1,94 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "block scalar script" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> uses: actions/github-script@v9 +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> with: +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> script: | +#^^^^^^^^^^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> console.log("Hello"); +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.begin.js +# ^^^^^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.end.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.terminator.statement.js +> process.exit(1); +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript constant.numeric.decimal.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.terminator.statement.js +> +#^ source.github-actions-workflow meta.embedded.inline.javascript diff --git a/language/syntaxes/test/actions-github-script/comment-after-script.test.yml b/language/syntaxes/test/actions-github-script/comment-after-script.test.yml new file mode 100644 index 00000000..e5fb4c2f --- /dev/null +++ b/language/syntaxes/test/actions-github-script/comment-after-script.test.yml @@ -0,0 +1,23 @@ +# SYNTAX TEST "source.github-actions-workflow" "comment after the `script` input" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Step 1 + uses: actions/github-script@v9 + with: + script: | + console.log("Hello"); + process.exit(1); + + # The next step. + - name: Step 2 + uses: actions/checkout@v7 + diff --git a/language/syntaxes/test/actions-github-script/comment-after-script.test.yml.snap b/language/syntaxes/test/actions-github-script/comment-after-script.test.yml.snap new file mode 100644 index 00000000..94bb0f1e --- /dev/null +++ b/language/syntaxes/test/actions-github-script/comment-after-script.test.yml.snap @@ -0,0 +1,120 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "comment after the `script` input" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step 1 +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> uses: actions/github-script@v9 +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> with: +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> script: | +#^^^^^^^^^^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> console.log("Hello"); +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.begin.js +# ^^^^^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.end.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.terminator.statement.js +> process.exit(1); +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript constant.numeric.decimal.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.terminator.statement.js +> +#^ source.github-actions-workflow meta.embedded.inline.javascript +> # The next step. +#^^^^^^ source.github-actions-workflow punctuation.whitespace.comment.leading.yaml +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> - name: Step 2 +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> uses: actions/checkout@v7 +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/actions-github-script/comments-after-properties.test.yml b/language/syntaxes/test/actions-github-script/comments-after-properties.test.yml new file mode 100644 index 00000000..9160aa96 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/comments-after-properties.test.yml @@ -0,0 +1,17 @@ +# SYNTAX TEST "source.github-actions-workflow" "comments after property names" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Step + uses: actions/github-script@v9 # ref + with: # comment. + script: | + console.log("Hello"); diff --git a/language/syntaxes/test/actions-github-script/comments-after-properties.test.yml.snap b/language/syntaxes/test/actions-github-script/comments-after-properties.test.yml.snap new file mode 100644 index 00000000..cb645707 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/comments-after-properties.test.yml.snap @@ -0,0 +1,91 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "comments after property names" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> uses: actions/github-script@v9 # ref +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> with: # comment. +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> script: | +#^^^^^^^^^^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> console.log("Hello"); +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.begin.js +# ^^^^^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.end.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.terminator.statement.js +> +#^ source.github-actions-workflow meta.embedded.inline.javascript diff --git a/language/syntaxes/test/actions-github-script/comments-between-properties.test.yml b/language/syntaxes/test/actions-github-script/comments-between-properties.test.yml new file mode 100644 index 00000000..b77280a4 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/comments-between-properties.test.yml @@ -0,0 +1,19 @@ +# SYNTAX TEST "source.github-actions-workflow" "comments between properties" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Step + uses: actions/github-script@v9 + # comment 1. + with: + # comment 2. + script: | + console.log("Hello"); diff --git a/language/syntaxes/test/actions-github-script/comments-between-properties.test.yml.snap b/language/syntaxes/test/actions-github-script/comments-between-properties.test.yml.snap new file mode 100644 index 00000000..f17ebc64 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/comments-between-properties.test.yml.snap @@ -0,0 +1,93 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "comments between properties" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> uses: actions/github-script@v9 +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> # comment 1. +#^^^^^^^^ source.github-actions-workflow punctuation.whitespace.comment.leading.yaml +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> with: +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> # comment 2. +#^^^^^^^^^^ source.github-actions-workflow punctuation.whitespace.comment.leading.yaml +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> script: | +#^^^^^^^^^^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> console.log("Hello"); +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.begin.js +# ^^^^^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.end.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.terminator.statement.js +> +#^ source.github-actions-workflow meta.embedded.inline.javascript diff --git a/language/syntaxes/test/actions-github-script/composite-action.test.yml b/language/syntaxes/test/actions-github-script/composite-action.test.yml new file mode 100644 index 00000000..58023cf7 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/composite-action.test.yml @@ -0,0 +1,13 @@ +name: Test + +description: Test + +runs: + using: composite + steps: + - name: Step + uses: actions/github-script@v9 + with: + script: | + console.log("Hello"); + process.exit(1); diff --git a/language/syntaxes/test/actions-github-script/composite-action.test.yml.snap b/language/syntaxes/test/actions-github-script/composite-action.test.yml.snap new file mode 100644 index 00000000..097055ac --- /dev/null +++ b/language/syntaxes/test/actions-github-script/composite-action.test.yml.snap @@ -0,0 +1,82 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>description: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>runs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> using: composite +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> steps: +#^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> uses: actions/github-script@v9 +#^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> with: +#^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> script: | +#^^^^^^^^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> console.log("Hello"); +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.begin.js +# ^^^^^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.end.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.terminator.statement.js +> process.exit(1); +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript constant.numeric.decimal.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.terminator.statement.js +> +#^ source.github-actions-workflow meta.embedded.inline.javascript diff --git a/language/syntaxes/test/actions-github-script/expression-in-script.test.yml b/language/syntaxes/test/actions-github-script/expression-in-script.test.yml new file mode 100644 index 00000000..81d2f318 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/expression-in-script.test.yml @@ -0,0 +1,18 @@ +# SYNTAX TEST "source.github-actions-workflow" "the script contains a `${{ }}` expression" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Step + uses: actions/github-script@v9 + with: + script: | + console.log("${{ github.event_name }}"); + debug: true diff --git a/language/syntaxes/test/actions-github-script/expression-in-script.test.yml.snap b/language/syntaxes/test/actions-github-script/expression-in-script.test.yml.snap new file mode 100644 index 00000000..2e37fe69 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/expression-in-script.test.yml.snap @@ -0,0 +1,102 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "the script contains a `${{ }}` expression" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +# ^^^ source.github-actions-workflow comment.line.number-sign.yaml meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow comment.line.number-sign.yaml meta.embedded.block.github-actions-expression +# ^^ source.github-actions-workflow comment.line.number-sign.yaml meta.embedded.block.github-actions-expression +# ^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> uses: actions/github-script@v9 +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> with: +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> script: | +#^^^^^^^^^^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> console.log("${{ github.event_name }}"); +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.begin.js +# ^^^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js meta.embedded.block.github-actions-expression +# ^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js meta.embedded.block.github-actions-expression +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js meta.embedded.block.github-actions-expression +# ^^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.end.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.terminator.statement.js +> debug: true +#^^^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow constant.language.boolean.yaml +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/actions-github-script/input-after-script-block.test.yml b/language/syntaxes/test/actions-github-script/input-after-script-block.test.yml new file mode 100644 index 00000000..119d55c3 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/input-after-script-block.test.yml @@ -0,0 +1,18 @@ +# SYNTAX TEST "source.github-actions-workflow" "another input after `script` input when the script is a block" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Step + uses: actions/github-script@v9 + with: + script: | + console.log("Hello"); + debug: true diff --git a/language/syntaxes/test/actions-github-script/input-after-script-block.test.yml.snap b/language/syntaxes/test/actions-github-script/input-after-script-block.test.yml.snap new file mode 100644 index 00000000..54c2d969 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/input-after-script-block.test.yml.snap @@ -0,0 +1,92 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "another input after `script` input when the script is a block" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> uses: actions/github-script@v9 +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> with: +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> script: | +#^^^^^^^^^^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> console.log("Hello"); +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.begin.js +# ^^^^^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.end.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.terminator.statement.js +> debug: true +#^^^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow constant.language.boolean.yaml +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/actions-github-script/input-after-script-plain.test.yml b/language/syntaxes/test/actions-github-script/input-after-script-plain.test.yml new file mode 100644 index 00000000..3e159dd5 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/input-after-script-plain.test.yml @@ -0,0 +1,17 @@ +# SYNTAX TEST "source.github-actions-workflow" "another input after `script` input when the script is a plain scalar" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Step + uses: actions/github-script@v9 + with: + script: console.log("Hello"); + debug: true diff --git a/language/syntaxes/test/actions-github-script/input-after-script-plain.test.yml.snap b/language/syntaxes/test/actions-github-script/input-after-script-plain.test.yml.snap new file mode 100644 index 00000000..3dafae2e --- /dev/null +++ b/language/syntaxes/test/actions-github-script/input-after-script-plain.test.yml.snap @@ -0,0 +1,89 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "another input after `script` input when the script is a plain scalar" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> uses: actions/github-script@v9 +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> with: +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> script: console.log("Hello"); +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript entity.name.tag.yaml +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.begin.js +# ^^^^^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.end.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.terminator.statement.js +> debug: true +#^^^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow constant.language.boolean.yaml +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/actions-github-script/input-before-script.test.yml b/language/syntaxes/test/actions-github-script/input-before-script.test.yml new file mode 100644 index 00000000..2de833d9 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/input-before-script.test.yml @@ -0,0 +1,18 @@ +# SYNTAX TEST "source.github-actions-workflow" "another input before `script` input" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Step + uses: actions/github-script@v9 + with: + debug: true + script: | + console.log("Hello"); diff --git a/language/syntaxes/test/actions-github-script/input-before-script.test.yml.snap b/language/syntaxes/test/actions-github-script/input-before-script.test.yml.snap new file mode 100644 index 00000000..b1056aca --- /dev/null +++ b/language/syntaxes/test/actions-github-script/input-before-script.test.yml.snap @@ -0,0 +1,92 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "another input before `script` input" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> uses: actions/github-script@v9 +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> with: +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> debug: true +#^^^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow constant.language.boolean.yaml +> script: | +#^^^^^^^^^^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> console.log("Hello"); +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.begin.js +# ^^^^^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.end.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.terminator.statement.js +> +#^ source.github-actions-workflow meta.embedded.inline.javascript diff --git a/language/syntaxes/test/actions-github-script/not-actions-github-script.test.yml b/language/syntaxes/test/actions-github-script/not-actions-github-script.test.yml new file mode 100644 index 00000000..716082d0 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/not-actions-github-script.test.yml @@ -0,0 +1,17 @@ +# SYNTAX TEST "source.github-actions-workflow" "not actions/github-script" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Step + uses: not-actions/github-script@main + with: + script: | + console.log("Hello"); diff --git a/language/syntaxes/test/actions-github-script/not-actions-github-script.test.yml.snap b/language/syntaxes/test/actions-github-script/not-actions-github-script.test.yml.snap new file mode 100644 index 00000000..e84d4ba8 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/not-actions-github-script.test.yml.snap @@ -0,0 +1,81 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "not actions/github-script" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> uses: not-actions/github-script@main +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> with: +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> script: | +#^^^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> console.log("Hello"); +#^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +# ^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +> +#^ source.github-actions-workflow string.unquoted.block.yaml diff --git a/language/syntaxes/test/actions-github-script/parallel-steps.test.yml b/language/syntaxes/test/actions-github-script/parallel-steps.test.yml new file mode 100644 index 00000000..c3119ce6 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/parallel-steps.test.yml @@ -0,0 +1,22 @@ +# SYNTAX TEST "source.github-actions-workflow" "parallel steps using `actions/github-script`" + +name: Test + +on: + workflow_dispatch: + +jobs: + job: + runs-on: ubuntu-latest + + steps: + - parallel: + - name: One + uses: actions/github-script@main + with: + script: console.log("One") + + - name: Two + uses: actions/github-script@main + with: + script: console.log("Two") diff --git a/language/syntaxes/test/actions-github-script/parallel-steps.test.yml.snap b/language/syntaxes/test/actions-github-script/parallel-steps.test.yml.snap new file mode 100644 index 00000000..830eb303 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/parallel-steps.test.yml.snap @@ -0,0 +1,123 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "parallel steps using `actions/github-script`" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> job: +#^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - parallel: +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: One +#^^^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> uses: actions/github-script@main +#^^^^^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> with: +#^^^^^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> script: console.log("One") +#^^^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript entity.name.tag.yaml +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.begin.js +# ^^^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.end.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +> +#^ source.github-actions-workflow meta.embedded.inline.javascript +> - name: Two +#^^^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> uses: actions/github-script@main +#^^^^^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> with: +#^^^^^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> script: console.log("Two") +#^^^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript entity.name.tag.yaml +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.begin.js +# ^^^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.end.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +> +#^ source.github-actions-workflow meta.embedded.inline.javascript diff --git a/language/syntaxes/test/actions-github-script/plain-single-line.test.yml b/language/syntaxes/test/actions-github-script/plain-single-line.test.yml new file mode 100644 index 00000000..4dae56e3 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/plain-single-line.test.yml @@ -0,0 +1,16 @@ +# SYNTAX TEST "source.github-actions-workflow" "plain flow scalar script on a single line" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Step + uses: actions/github-script@v9 + with: + script: console.log("Hello"); diff --git a/language/syntaxes/test/actions-github-script/plain-single-line.test.yml.snap b/language/syntaxes/test/actions-github-script/plain-single-line.test.yml.snap new file mode 100644 index 00000000..c71cb19a --- /dev/null +++ b/language/syntaxes/test/actions-github-script/plain-single-line.test.yml.snap @@ -0,0 +1,82 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "plain flow scalar script on a single line" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> uses: actions/github-script@v9 +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> with: +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> script: console.log("Hello"); +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript entity.name.tag.yaml +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.begin.js +# ^^^^^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.end.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.terminator.statement.js +> +#^ source.github-actions-workflow meta.embedded.inline.javascript diff --git a/language/syntaxes/test/actions-github-script/plain-wrapped.test.yml b/language/syntaxes/test/actions-github-script/plain-wrapped.test.yml new file mode 100644 index 00000000..07477de0 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/plain-wrapped.test.yml @@ -0,0 +1,18 @@ +# SYNTAX TEST "source.github-actions-workflow" "plain flow scalar script wrapped over multiple lines" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Step + uses: actions/github-script@v9 + with: + script: console.log( + "Hello" + ); process.exit(1); diff --git a/language/syntaxes/test/actions-github-script/plain-wrapped.test.yml.snap b/language/syntaxes/test/actions-github-script/plain-wrapped.test.yml.snap new file mode 100644 index 00000000..c9b7bdc6 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/plain-wrapped.test.yml.snap @@ -0,0 +1,94 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "plain flow scalar script wrapped over multiple lines" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> uses: actions/github-script@v9 +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> with: +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> script: console.log( +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript entity.name.tag.yaml +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +> "Hello" +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.begin.js +# ^^^^^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.end.js +> ); process.exit(1); +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.terminator.statement.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript constant.numeric.decimal.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.terminator.statement.js +> +#^ source.github-actions-workflow meta.embedded.inline.javascript diff --git a/language/syntaxes/test/actions-github-script/step-after-script.test.yml b/language/syntaxes/test/actions-github-script/step-after-script.test.yml new file mode 100644 index 00000000..3c526bc6 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/step-after-script.test.yml @@ -0,0 +1,20 @@ +# SYNTAX TEST "source.github-actions-workflow" "another step follows the `actions/github-script` step" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Step 1 + uses: actions/github-script@v9 + with: + script: | + console.log("Hello"); + + - name: Step 2 + uses: actions/checkout@v7 diff --git a/language/syntaxes/test/actions-github-script/step-after-script.test.yml.snap b/language/syntaxes/test/actions-github-script/step-after-script.test.yml.snap new file mode 100644 index 00000000..bbae6647 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/step-after-script.test.yml.snap @@ -0,0 +1,106 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "another step follows the `actions/github-script` step" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step 1 +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> uses: actions/github-script@v9 +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^ source.github-actions-workflow invalid.illegal.expected-comment-or-newline.yaml +> with: +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> script: | +#^^^^^^^^^^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> console.log("Hello"); +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.begin.js +# ^^^^^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.end.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.terminator.statement.js +> +#^ source.github-actions-workflow meta.embedded.inline.javascript +> - name: Step 2 +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> uses: actions/checkout@v7 +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/actions-github-script/uses-as-first-property.test.yml b/language/syntaxes/test/actions-github-script/uses-as-first-property.test.yml new file mode 100644 index 00000000..a65e5bfc --- /dev/null +++ b/language/syntaxes/test/actions-github-script/uses-as-first-property.test.yml @@ -0,0 +1,16 @@ +# SYNTAX TEST "source.github-actions-workflow" "`uses` as first property in step" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/github-script@v9 # ref + with: + script: | + console.log("Hello"); diff --git a/language/syntaxes/test/actions-github-script/uses-as-first-property.test.yml.snap b/language/syntaxes/test/actions-github-script/uses-as-first-property.test.yml.snap new file mode 100644 index 00000000..8e201386 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/uses-as-first-property.test.yml.snap @@ -0,0 +1,80 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "`uses` as first property in step" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - uses: actions/github-script@v9 # ref +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> with: +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> script: | +#^^^^^^^^^^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> console.log("Hello"); +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.begin.js +# ^^^^^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.end.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.terminator.statement.js +> +#^ source.github-actions-workflow meta.embedded.inline.javascript From f4ef5d549c2a81cef1de5d8451e2d0101efce4a3 Mon Sep 17 00:00:00 2001 From: reduckted Date: Wed, 12 Aug 2026 20:39:24 +1000 Subject: [PATCH 8/9] Added tests for the `run` grammar. --- ...=> comments-after-property-names.test.yml} | 0 ...mments-after-property-names.test.yml.snap} | 0 .../composite-action.test.yml | 2 + .../composite-action.test.yml.snap | 5 + .../invalid-content.test.yml | 16 ++ .../invalid-content.test.yml.snap | 80 +++++++ .../blank-lines-between-properties.test.yml | 45 ++++ ...ank-lines-between-properties.test.yml.snap | 184 +++++++++++++++ .../test/run/blank-lines-in-block.test.yml | 18 ++ .../run/blank-lines-in-block.test.yml.snap | 97 ++++++++ .../test/run/block-shell-bash.test.yml | 15 ++ .../test/run/block-shell-bash.test.yml.snap | 71 ++++++ .../test/run/block-shell-cmd.test.yml | 15 ++ .../test/run/block-shell-cmd.test.yml.snap | 72 ++++++ .../test/run/block-shell-powershell.test.yml | 15 ++ .../run/block-shell-powershell.test.yml.snap | 72 ++++++ .../test/run/block-shell-pwsh.test.yml | 15 ++ .../test/run/block-shell-pwsh.test.yml.snap | 72 ++++++ .../test/run/block-shell-python.test.yml | 15 ++ .../test/run/block-shell-python.test.yml.snap | 74 ++++++ .../syntaxes/test/run/block-shell-sh.test.yml | 15 ++ .../test/run/block-shell-sh.test.yml.snap | 71 ++++++ .../test/run/comment-after-run.test.yml | 15 ++ .../test/run/comment-after-run.test.yml.snap | 70 ++++++ .../comments-after-property-names.test.yml | 32 +++ ...omments-after-property-names.test.yml.snap | 212 +++++++++++++++++ .../run/comments-between-properties.test.yml | 45 ++++ .../comments-between-properties.test.yml.snap | 217 ++++++++++++++++++ .../test/run/composite-action.test.yml | 13 ++ .../test/run/composite-action.test.yml.snap | 70 ++++++ .../test/run/expression-in-run.test.yml | 25 ++ .../test/run/expression-in-run.test.yml.snap | 152 ++++++++++++ .../test/run/invalid-content.test.yml | 32 +++ .../test/run/invalid-content.test.yml.snap | 172 ++++++++++++++ .../test/run/job-has-default-shell.test.yml | 35 +++ .../run/job-has-default-shell.test.yml.snap | 186 +++++++++++++++ .../job-has-defaults-but-no-shell.test.yml | 29 +++ ...ob-has-defaults-but-no-shell.test.yml.snap | 148 ++++++++++++ language/syntaxes/test/run/no-shell.test.yml | 16 ++ .../syntaxes/test/run/no-shell.test.yml.snap | 78 +++++++ .../syntaxes/test/run/parallel-steps.test.yml | 39 ++++ .../test/run/parallel-steps.test.yml.snap | 209 +++++++++++++++++ .../test/run/plain-shell-bash.test.yml | 13 ++ .../test/run/plain-shell-bash.test.yml.snap | 63 +++++ .../test/run/plain-shell-cmd.test.yml | 13 ++ .../test/run/plain-shell-cmd.test.yml.snap | 64 ++++++ .../test/run/plain-shell-powershell.test.yml | 13 ++ .../run/plain-shell-powershell.test.yml.snap | 64 ++++++ .../test/run/plain-shell-pwsh.test.yml | 13 ++ .../test/run/plain-shell-pwsh.test.yml.snap | 64 ++++++ .../test/run/plain-shell-python.test.yml | 13 ++ .../test/run/plain-shell-python.test.yml.snap | 65 ++++++ .../syntaxes/test/run/plain-shell-sh.test.yml | 13 ++ .../test/run/plain-shell-sh.test.yml.snap | 63 +++++ .../syntaxes/test/run/plain-wrapped.test.yml | 16 ++ .../test/run/plain-wrapped.test.yml.snap | 80 +++++++ .../properties-between-shell-and-run.test.yml | 18 ++ ...erties-between-shell-and-run.test.yml.snap | 93 ++++++++ .../test/run/run-as-input-to-action.test.yml | 20 ++ .../run/run-as-input-to-action.test.yml.snap | 88 +++++++ .../test/run/shell-after-run.test.yml | 19 ++ .../test/run/shell-after-run.test.yml.snap | 88 +++++++ .../test/run/shell-as-first-property.test.yml | 14 ++ .../run/shell-as-first-property.test.yml.snap | 64 ++++++ .../syntaxes/test/run/step-after-run.test.yml | 19 ++ .../test/run/step-after-run.test.yml.snap | 86 +++++++ .../run/workflow-has-default-shell.test.yml | 35 +++ .../workflow-has-default-shell.test.yml.snap | 189 +++++++++++++++ ...orkflow-has-defaults-but-no-shell.test.yml | 29 +++ ...ow-has-defaults-but-no-shell.test.yml.snap | 149 ++++++++++++ ...s-shell-and-job-has-default-shell.test.yml | 39 ++++ ...ll-and-job-has-default-shell.test.yml.snap | 203 ++++++++++++++++ 72 files changed, 4474 insertions(+) rename language/syntaxes/test/actions-github-script/{comments-after-properties.test.yml => comments-after-property-names.test.yml} (100%) rename language/syntaxes/test/actions-github-script/{comments-after-properties.test.yml.snap => comments-after-property-names.test.yml.snap} (100%) create mode 100644 language/syntaxes/test/actions-github-script/invalid-content.test.yml create mode 100644 language/syntaxes/test/actions-github-script/invalid-content.test.yml.snap create mode 100644 language/syntaxes/test/run/blank-lines-between-properties.test.yml create mode 100644 language/syntaxes/test/run/blank-lines-between-properties.test.yml.snap create mode 100644 language/syntaxes/test/run/blank-lines-in-block.test.yml create mode 100644 language/syntaxes/test/run/blank-lines-in-block.test.yml.snap create mode 100644 language/syntaxes/test/run/block-shell-bash.test.yml create mode 100644 language/syntaxes/test/run/block-shell-bash.test.yml.snap create mode 100644 language/syntaxes/test/run/block-shell-cmd.test.yml create mode 100644 language/syntaxes/test/run/block-shell-cmd.test.yml.snap create mode 100644 language/syntaxes/test/run/block-shell-powershell.test.yml create mode 100644 language/syntaxes/test/run/block-shell-powershell.test.yml.snap create mode 100644 language/syntaxes/test/run/block-shell-pwsh.test.yml create mode 100644 language/syntaxes/test/run/block-shell-pwsh.test.yml.snap create mode 100644 language/syntaxes/test/run/block-shell-python.test.yml create mode 100644 language/syntaxes/test/run/block-shell-python.test.yml.snap create mode 100644 language/syntaxes/test/run/block-shell-sh.test.yml create mode 100644 language/syntaxes/test/run/block-shell-sh.test.yml.snap create mode 100644 language/syntaxes/test/run/comment-after-run.test.yml create mode 100644 language/syntaxes/test/run/comment-after-run.test.yml.snap create mode 100644 language/syntaxes/test/run/comments-after-property-names.test.yml create mode 100644 language/syntaxes/test/run/comments-after-property-names.test.yml.snap create mode 100644 language/syntaxes/test/run/comments-between-properties.test.yml create mode 100644 language/syntaxes/test/run/comments-between-properties.test.yml.snap create mode 100644 language/syntaxes/test/run/composite-action.test.yml create mode 100644 language/syntaxes/test/run/composite-action.test.yml.snap create mode 100644 language/syntaxes/test/run/expression-in-run.test.yml create mode 100644 language/syntaxes/test/run/expression-in-run.test.yml.snap create mode 100644 language/syntaxes/test/run/invalid-content.test.yml create mode 100644 language/syntaxes/test/run/invalid-content.test.yml.snap create mode 100644 language/syntaxes/test/run/job-has-default-shell.test.yml create mode 100644 language/syntaxes/test/run/job-has-default-shell.test.yml.snap create mode 100644 language/syntaxes/test/run/job-has-defaults-but-no-shell.test.yml create mode 100644 language/syntaxes/test/run/job-has-defaults-but-no-shell.test.yml.snap create mode 100644 language/syntaxes/test/run/no-shell.test.yml create mode 100644 language/syntaxes/test/run/no-shell.test.yml.snap create mode 100644 language/syntaxes/test/run/parallel-steps.test.yml create mode 100644 language/syntaxes/test/run/parallel-steps.test.yml.snap create mode 100644 language/syntaxes/test/run/plain-shell-bash.test.yml create mode 100644 language/syntaxes/test/run/plain-shell-bash.test.yml.snap create mode 100644 language/syntaxes/test/run/plain-shell-cmd.test.yml create mode 100644 language/syntaxes/test/run/plain-shell-cmd.test.yml.snap create mode 100644 language/syntaxes/test/run/plain-shell-powershell.test.yml create mode 100644 language/syntaxes/test/run/plain-shell-powershell.test.yml.snap create mode 100644 language/syntaxes/test/run/plain-shell-pwsh.test.yml create mode 100644 language/syntaxes/test/run/plain-shell-pwsh.test.yml.snap create mode 100644 language/syntaxes/test/run/plain-shell-python.test.yml create mode 100644 language/syntaxes/test/run/plain-shell-python.test.yml.snap create mode 100644 language/syntaxes/test/run/plain-shell-sh.test.yml create mode 100644 language/syntaxes/test/run/plain-shell-sh.test.yml.snap create mode 100644 language/syntaxes/test/run/plain-wrapped.test.yml create mode 100644 language/syntaxes/test/run/plain-wrapped.test.yml.snap create mode 100644 language/syntaxes/test/run/properties-between-shell-and-run.test.yml create mode 100644 language/syntaxes/test/run/properties-between-shell-and-run.test.yml.snap create mode 100644 language/syntaxes/test/run/run-as-input-to-action.test.yml create mode 100644 language/syntaxes/test/run/run-as-input-to-action.test.yml.snap create mode 100644 language/syntaxes/test/run/shell-after-run.test.yml create mode 100644 language/syntaxes/test/run/shell-after-run.test.yml.snap create mode 100644 language/syntaxes/test/run/shell-as-first-property.test.yml create mode 100644 language/syntaxes/test/run/shell-as-first-property.test.yml.snap create mode 100644 language/syntaxes/test/run/step-after-run.test.yml create mode 100644 language/syntaxes/test/run/step-after-run.test.yml.snap create mode 100644 language/syntaxes/test/run/workflow-has-default-shell.test.yml create mode 100644 language/syntaxes/test/run/workflow-has-default-shell.test.yml.snap create mode 100644 language/syntaxes/test/run/workflow-has-defaults-but-no-shell.test.yml create mode 100644 language/syntaxes/test/run/workflow-has-defaults-but-no-shell.test.yml.snap create mode 100644 language/syntaxes/test/run/workflow-has-defaults-shell-and-job-has-default-shell.test.yml create mode 100644 language/syntaxes/test/run/workflow-has-defaults-shell-and-job-has-default-shell.test.yml.snap diff --git a/language/syntaxes/test/actions-github-script/comments-after-properties.test.yml b/language/syntaxes/test/actions-github-script/comments-after-property-names.test.yml similarity index 100% rename from language/syntaxes/test/actions-github-script/comments-after-properties.test.yml rename to language/syntaxes/test/actions-github-script/comments-after-property-names.test.yml diff --git a/language/syntaxes/test/actions-github-script/comments-after-properties.test.yml.snap b/language/syntaxes/test/actions-github-script/comments-after-property-names.test.yml.snap similarity index 100% rename from language/syntaxes/test/actions-github-script/comments-after-properties.test.yml.snap rename to language/syntaxes/test/actions-github-script/comments-after-property-names.test.yml.snap diff --git a/language/syntaxes/test/actions-github-script/composite-action.test.yml b/language/syntaxes/test/actions-github-script/composite-action.test.yml index 58023cf7..1a28e6cb 100644 --- a/language/syntaxes/test/actions-github-script/composite-action.test.yml +++ b/language/syntaxes/test/actions-github-script/composite-action.test.yml @@ -1,3 +1,5 @@ +# SYNTAX TEST "source.github-actions-workflow" "`actions/github-script` used in a composite action" + name: Test description: Test diff --git a/language/syntaxes/test/actions-github-script/composite-action.test.yml.snap b/language/syntaxes/test/actions-github-script/composite-action.test.yml.snap index 097055ac..1df3f118 100644 --- a/language/syntaxes/test/actions-github-script/composite-action.test.yml.snap +++ b/language/syntaxes/test/actions-github-script/composite-action.test.yml.snap @@ -1,4 +1,9 @@ # SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "`actions/github-script` used in a composite action" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow >name: Test #^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml # ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml diff --git a/language/syntaxes/test/actions-github-script/invalid-content.test.yml b/language/syntaxes/test/actions-github-script/invalid-content.test.yml new file mode 100644 index 00000000..e726e457 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/invalid-content.test.yml @@ -0,0 +1,16 @@ +# SYNTAX TEST "source.github-actions-workflow" "invalid content at the end of lines" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/github-script@v9 test + with: test + script: | test + console.log("Hello"); diff --git a/language/syntaxes/test/actions-github-script/invalid-content.test.yml.snap b/language/syntaxes/test/actions-github-script/invalid-content.test.yml.snap new file mode 100644 index 00000000..a65b47a6 --- /dev/null +++ b/language/syntaxes/test/actions-github-script/invalid-content.test.yml.snap @@ -0,0 +1,80 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "invalid content at the end of lines" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - uses: actions/github-script@v9 test +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^ source.github-actions-workflow invalid.illegal.expected-comment-or-newline.yaml +> with: test +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^^^^^ source.github-actions-workflow invalid.illegal.expected-comment-or-newline.yaml +> script: | test +#^^^^^^^^^^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +# ^^^^^ source.github-actions-workflow invalid.illegal.expected-comment-or-newline.yaml +> console.log("Hello"); +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript +# ^^^^^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js variable.other.object.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js punctuation.accessor.js +# ^^^ source.github-actions-workflow meta.embedded.inline.javascript meta.function-call.js entity.name.function.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.begin.js +# ^^^^^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript string.quoted.double.js punctuation.definition.string.end.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript meta.brace.round.js +# ^ source.github-actions-workflow meta.embedded.inline.javascript punctuation.terminator.statement.js +> +#^ source.github-actions-workflow meta.embedded.inline.javascript diff --git a/language/syntaxes/test/run/blank-lines-between-properties.test.yml b/language/syntaxes/test/run/blank-lines-between-properties.test.yml new file mode 100644 index 00000000..8b76d9bf --- /dev/null +++ b/language/syntaxes/test/run/blank-lines-between-properties.test.yml @@ -0,0 +1,45 @@ +# SYNTAX TEST "source.github-actions-workflow" "blank lines between properties" + +name: Test + +on: + workflow_dispatch: + +defaults: + + run: + + shell: pwsh + +jobs: + + a: + + defaults: + + run: + + shell: python + + steps: + + - name: First + + shell: cmd + + run: | + echo "Hello" + + - name: Second + + run: | + print("Hello") + + b: + + steps: + + - name: First + + run: | + Write-Host "Hello" diff --git a/language/syntaxes/test/run/blank-lines-between-properties.test.yml.snap b/language/syntaxes/test/run/blank-lines-between-properties.test.yml.snap new file mode 100644 index 00000000..aa159f00 --- /dev/null +++ b/language/syntaxes/test/run/blank-lines-between-properties.test.yml.snap @@ -0,0 +1,184 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "blank lines between properties" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>defaults: +#^^^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +> run: +#^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +> shell: pwsh +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +> a: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +> defaults: +#^^^^ source.github-actions-workflow +# ^^^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +> run: +#^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +> shell: python +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +> - name: First +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> shell: cmd +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> echo "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^^^^ source.github-actions-workflow meta.embedded.inline.batchfile keyword.command.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.begin.batchfile +# ^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.end.batchfile +> +#^ source.github-actions-workflow meta.embedded.inline.batchfile +> - name: Second +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> print("Hello") +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python support.function.builtin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.begin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.begin.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.end.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.end.python +# ^^ source.github-actions-workflow meta.embedded.inline.python +> +#^ source.github-actions-workflow meta.embedded.inline.python +> b: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +> - name: First +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> Write-Host "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell support.function.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell +> +#^ source.github-actions-workflow meta.embedded.inline.powershell diff --git a/language/syntaxes/test/run/blank-lines-in-block.test.yml b/language/syntaxes/test/run/blank-lines-in-block.test.yml new file mode 100644 index 00000000..4aa00a2f --- /dev/null +++ b/language/syntaxes/test/run/blank-lines-in-block.test.yml @@ -0,0 +1,18 @@ +# SYNTAX TEST "source.github-actions-workflow" "blank lines in block" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + steps: + - name: Test + shell: bash + run: | + one=1 + two=2 + three=2 + + echo "${one} + ${two} = ${three}" diff --git a/language/syntaxes/test/run/blank-lines-in-block.test.yml.snap b/language/syntaxes/test/run/blank-lines-in-block.test.yml.snap new file mode 100644 index 00000000..73922a96 --- /dev/null +++ b/language/syntaxes/test/run/blank-lines-in-block.test.yml.snap @@ -0,0 +1,97 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "blank lines in block" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Test +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: bash +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> one=1 +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.shell +# ^^^ source.github-actions-workflow meta.embedded.inline.shell meta.expression.assignment.shell variable.other.assignment.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.expression.assignment.shell keyword.operator.assignment.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.expression.assignment.shell string.unquoted.shell +> two=2 +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.shell meta.expression.assignment.shell +# ^^^ source.github-actions-workflow meta.embedded.inline.shell meta.expression.assignment.shell variable.other.assignment.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.expression.assignment.shell keyword.operator.assignment.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.expression.assignment.shell string.unquoted.shell +> three=2 +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.shell meta.expression.assignment.shell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.shell meta.expression.assignment.shell variable.other.assignment.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.expression.assignment.shell keyword.operator.assignment.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.expression.assignment.shell string.unquoted.shell +> +#^ source.github-actions-workflow meta.embedded.inline.shell +> echo "${one} + ${two} = ${three}" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell +# ^^^^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.statement.command.name.shell entity.name.function.call.shell entity.name.command.shell support.function.builtin.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.argument.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell punctuation.definition.string.begin.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell punctuation.definition.variable.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell +# ^^^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell meta.parameter-expansion variable.other.normal.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell +# ^^^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell punctuation.definition.variable.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell +# ^^^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell meta.parameter-expansion variable.other.normal.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell +# ^^^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell punctuation.definition.variable.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell meta.parameter-expansion variable.other.normal.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.argument.shell string.quoted.double.shell punctuation.definition.string.end.shell +> +#^ source.github-actions-workflow meta.embedded.inline.shell diff --git a/language/syntaxes/test/run/block-shell-bash.test.yml b/language/syntaxes/test/run/block-shell-bash.test.yml new file mode 100644 index 00000000..5ca5fef0 --- /dev/null +++ b/language/syntaxes/test/run/block-shell-bash.test.yml @@ -0,0 +1,15 @@ +# SYNTAX TEST "source.github-actions-workflow" "block scalar using `bash` shell" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + steps: + - name: Test + shell: bash + run: | + echo "Hello" + exit 1 diff --git a/language/syntaxes/test/run/block-shell-bash.test.yml.snap b/language/syntaxes/test/run/block-shell-bash.test.yml.snap new file mode 100644 index 00000000..a650147c --- /dev/null +++ b/language/syntaxes/test/run/block-shell-bash.test.yml.snap @@ -0,0 +1,71 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "block scalar using `bash` shell" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Test +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: bash +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> echo "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.shell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell punctuation.definition.string.begin.shell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell punctuation.definition.string.end.shell +> exit 1 +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell +# ^^^^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.statement.command.name.shell entity.name.function.call.shell entity.name.command.shell support.function.builtin.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.argument.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.argument.shell string.unquoted.argument.shell constant.numeric.shell constant.numeric.integer.shell +> +#^ source.github-actions-workflow meta.embedded.inline.shell diff --git a/language/syntaxes/test/run/block-shell-cmd.test.yml b/language/syntaxes/test/run/block-shell-cmd.test.yml new file mode 100644 index 00000000..6a7b3b38 --- /dev/null +++ b/language/syntaxes/test/run/block-shell-cmd.test.yml @@ -0,0 +1,15 @@ +# SYNTAX TEST "source.github-actions-workflow" "block scalar using `cmd` shell" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + steps: + - name: Test + shell: cmd + run: | + echo "Hello" + exit 1 diff --git a/language/syntaxes/test/run/block-shell-cmd.test.yml.snap b/language/syntaxes/test/run/block-shell-cmd.test.yml.snap new file mode 100644 index 00000000..13c3a628 --- /dev/null +++ b/language/syntaxes/test/run/block-shell-cmd.test.yml.snap @@ -0,0 +1,72 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "block scalar using `cmd` shell" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Test +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: cmd +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> echo "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^^^^ source.github-actions-workflow meta.embedded.inline.batchfile keyword.command.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.begin.batchfile +# ^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.end.batchfile +> exit 1 +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^^^^ source.github-actions-workflow meta.embedded.inline.batchfile keyword.control.statement.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile constant.numeric.batchfile +> +#^ source.github-actions-workflow meta.embedded.inline.batchfile diff --git a/language/syntaxes/test/run/block-shell-powershell.test.yml b/language/syntaxes/test/run/block-shell-powershell.test.yml new file mode 100644 index 00000000..0840f11f --- /dev/null +++ b/language/syntaxes/test/run/block-shell-powershell.test.yml @@ -0,0 +1,15 @@ +# SYNTAX TEST "source.github-actions-workflow" "block scalar using `powershell` shell" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + steps: + - name: Test + shell: powershell + run: | + Write-Host "Hello" + exit 1 diff --git a/language/syntaxes/test/run/block-shell-powershell.test.yml.snap b/language/syntaxes/test/run/block-shell-powershell.test.yml.snap new file mode 100644 index 00000000..bff66a81 --- /dev/null +++ b/language/syntaxes/test/run/block-shell-powershell.test.yml.snap @@ -0,0 +1,72 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "block scalar using `powershell` shell" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Test +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: powershell +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> Write-Host "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell support.function.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell +> exit 1 +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^^ source.github-actions-workflow meta.embedded.inline.powershell keyword.control.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell constant.numeric.integer.powershell +> +#^ source.github-actions-workflow meta.embedded.inline.powershell diff --git a/language/syntaxes/test/run/block-shell-pwsh.test.yml b/language/syntaxes/test/run/block-shell-pwsh.test.yml new file mode 100644 index 00000000..7d6c599a --- /dev/null +++ b/language/syntaxes/test/run/block-shell-pwsh.test.yml @@ -0,0 +1,15 @@ +# SYNTAX TEST "source.github-actions-workflow" "block scalar using `pwsh` shell" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + steps: + - name: Test + shell: pwsh + run: | + Write-Host "Hello" + exit 1 diff --git a/language/syntaxes/test/run/block-shell-pwsh.test.yml.snap b/language/syntaxes/test/run/block-shell-pwsh.test.yml.snap new file mode 100644 index 00000000..f4856733 --- /dev/null +++ b/language/syntaxes/test/run/block-shell-pwsh.test.yml.snap @@ -0,0 +1,72 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "block scalar using `pwsh` shell" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Test +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: pwsh +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> Write-Host "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell support.function.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell +> exit 1 +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^^ source.github-actions-workflow meta.embedded.inline.powershell keyword.control.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell constant.numeric.integer.powershell +> +#^ source.github-actions-workflow meta.embedded.inline.powershell diff --git a/language/syntaxes/test/run/block-shell-python.test.yml b/language/syntaxes/test/run/block-shell-python.test.yml new file mode 100644 index 00000000..67c1bc29 --- /dev/null +++ b/language/syntaxes/test/run/block-shell-python.test.yml @@ -0,0 +1,15 @@ +# SYNTAX TEST "source.github-actions-workflow" "block scalar using `python` shell" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + steps: + - name: Test + shell: python + run: | + print("Hello") + exit(1) diff --git a/language/syntaxes/test/run/block-shell-python.test.yml.snap b/language/syntaxes/test/run/block-shell-python.test.yml.snap new file mode 100644 index 00000000..455a51d2 --- /dev/null +++ b/language/syntaxes/test/run/block-shell-python.test.yml.snap @@ -0,0 +1,74 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "block scalar using `python` shell" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Test +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: python +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> print("Hello") +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python support.function.builtin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.begin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.begin.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.end.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.end.python +> exit(1) +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python +# ^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python support.function.builtin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.begin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python constant.numeric.dec.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.end.python +> +#^ source.github-actions-workflow meta.embedded.inline.python diff --git a/language/syntaxes/test/run/block-shell-sh.test.yml b/language/syntaxes/test/run/block-shell-sh.test.yml new file mode 100644 index 00000000..68c6ea65 --- /dev/null +++ b/language/syntaxes/test/run/block-shell-sh.test.yml @@ -0,0 +1,15 @@ +# SYNTAX TEST "source.github-actions-workflow" "block scalar using `sh` shell" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + steps: + - name: Test + shell: sh + run: | + echo "Hello" + exit 1 diff --git a/language/syntaxes/test/run/block-shell-sh.test.yml.snap b/language/syntaxes/test/run/block-shell-sh.test.yml.snap new file mode 100644 index 00000000..dc7b61d3 --- /dev/null +++ b/language/syntaxes/test/run/block-shell-sh.test.yml.snap @@ -0,0 +1,71 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "block scalar using `sh` shell" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Test +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: sh +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> echo "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.shell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell punctuation.definition.string.begin.shell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell punctuation.definition.string.end.shell +> exit 1 +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell +# ^^^^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.statement.command.name.shell entity.name.function.call.shell entity.name.command.shell support.function.builtin.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.argument.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell meta.statement.shell meta.statement.command.shell meta.argument.shell string.unquoted.argument.shell constant.numeric.shell constant.numeric.integer.shell +> +#^ source.github-actions-workflow meta.embedded.inline.shell diff --git a/language/syntaxes/test/run/comment-after-run.test.yml b/language/syntaxes/test/run/comment-after-run.test.yml new file mode 100644 index 00000000..e8362fef --- /dev/null +++ b/language/syntaxes/test/run/comment-after-run.test.yml @@ -0,0 +1,15 @@ +# SYNTAX TEST "source.github-actions-workflow" "comment after a block scalar `run` property" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + steps: + - name: Test + shell: bash + run: | + echo "Hello" + # Comment after run. diff --git a/language/syntaxes/test/run/comment-after-run.test.yml.snap b/language/syntaxes/test/run/comment-after-run.test.yml.snap new file mode 100644 index 00000000..144fd5a1 --- /dev/null +++ b/language/syntaxes/test/run/comment-after-run.test.yml.snap @@ -0,0 +1,70 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "comment after a block scalar `run` property" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Test +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: bash +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> echo "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.shell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell punctuation.definition.string.begin.shell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell punctuation.definition.string.end.shell +> # Comment after run. +#^^^^^^^^ source.github-actions-workflow punctuation.whitespace.comment.leading.yaml +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/run/comments-after-property-names.test.yml b/language/syntaxes/test/run/comments-after-property-names.test.yml new file mode 100644 index 00000000..7ed48883 --- /dev/null +++ b/language/syntaxes/test/run/comments-after-property-names.test.yml @@ -0,0 +1,32 @@ +# SYNTAX TEST "source.github-actions-workflow" "comments after property names" + +name: Test + +on: + workflow_dispatch: # workflow defaults. + +defaults: # action. + run: # shell type. + shell: pwsh + +jobs: # jobs are next. + a: # first job. + defaults: # job defaults + run: # action. + shell: python # shell type. + + steps: # the steps. + - name: First # first step. + shell: cmd # set the shell. + run: | # run a script. + echo "Hello" + + - name: Second # second step. + run: | # use job default shell. + print("Hello") + + b: # second job. + steps: # the steps. + - name: First # first step. + run: | # use workflow default. + Write-Host "Hello" diff --git a/language/syntaxes/test/run/comments-after-property-names.test.yml.snap b/language/syntaxes/test/run/comments-after-property-names.test.yml.snap new file mode 100644 index 00000000..896e93ea --- /dev/null +++ b/language/syntaxes/test/run/comments-after-property-names.test.yml.snap @@ -0,0 +1,212 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "comments after property names" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: # workflow defaults. +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>defaults: # action. +#^^^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> run: # shell type. +#^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> shell: pwsh +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>jobs: # jobs are next. +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> a: # first job. +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> defaults: # job defaults +#^^^^ source.github-actions-workflow +# ^^^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> run: # action. +#^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> shell: python # shell type. +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +> steps: # the steps. +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> - name: First # first step. +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> shell: cmd # set the shell. +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> run: | # run a script. +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> echo "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^^^^ source.github-actions-workflow meta.embedded.inline.batchfile keyword.command.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.begin.batchfile +# ^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.end.batchfile +> +#^ source.github-actions-workflow meta.embedded.inline.batchfile +> - name: Second # second step. +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> run: | # use job default shell. +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> print("Hello") +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python support.function.builtin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.begin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.begin.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.end.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.end.python +# ^^ source.github-actions-workflow meta.embedded.inline.python +> +#^ source.github-actions-workflow meta.embedded.inline.python +> b: # second job. +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> steps: # the steps. +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> - name: First # first step. +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> run: | # use workflow default. +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> Write-Host "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell support.function.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell +> +#^ source.github-actions-workflow meta.embedded.inline.powershell diff --git a/language/syntaxes/test/run/comments-between-properties.test.yml b/language/syntaxes/test/run/comments-between-properties.test.yml new file mode 100644 index 00000000..27f10556 --- /dev/null +++ b/language/syntaxes/test/run/comments-between-properties.test.yml @@ -0,0 +1,45 @@ +# SYNTAX TEST "source.github-actions-workflow" "comments between properties" + +name: Test + +on: + workflow_dispatch: +# workflow defaults. +defaults: + # action. + run: + # shell type. + shell: pwsh +# jobs are next. +jobs: + # first job. + a: + # job defaults + defaults: + # action. + run: + # shell type. + shell: python + # the steps. + steps: + # first step. + - name: First + # set the shell. + shell: cmd + # run a script. + run: | + echo "Hello" + # second step. + - name: Second + # use job default shell. + run: | + print("Hello") +# second job. + b: + # the steps. + steps: + # first step. + - name: First + # use workflow default. + run: | + Write-Host "Hello" diff --git a/language/syntaxes/test/run/comments-between-properties.test.yml.snap b/language/syntaxes/test/run/comments-between-properties.test.yml.snap new file mode 100644 index 00000000..010a9927 --- /dev/null +++ b/language/syntaxes/test/run/comments-between-properties.test.yml.snap @@ -0,0 +1,217 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "comments between properties" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +># workflow defaults. +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +>defaults: +#^^^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> # action. +#^^ source.github-actions-workflow punctuation.whitespace.comment.leading.yaml +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> run: +#^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> # shell type. +#^^^^ source.github-actions-workflow punctuation.whitespace.comment.leading.yaml +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> shell: pwsh +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +># jobs are next. +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> # first job. +#^^ source.github-actions-workflow punctuation.whitespace.comment.leading.yaml +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> a: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> # job defaults +#^^^^ source.github-actions-workflow punctuation.whitespace.comment.leading.yaml +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> defaults: +#^^^^ source.github-actions-workflow +# ^^^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> # action. +#^^^^^^ source.github-actions-workflow punctuation.whitespace.comment.leading.yaml +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> run: +#^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> # shell type. +#^^^^^^^^ source.github-actions-workflow punctuation.whitespace.comment.leading.yaml +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> shell: python +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> # the steps. +#^^^^ source.github-actions-workflow punctuation.whitespace.comment.leading.yaml +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> # first step. +#^^^^^^ source.github-actions-workflow punctuation.whitespace.comment.leading.yaml +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> - name: First +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> # set the shell. +#^^^^^^^^ source.github-actions-workflow punctuation.whitespace.comment.leading.yaml +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> shell: cmd +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> # run a script. +#^^^^^^^^ source.github-actions-workflow punctuation.whitespace.comment.leading.yaml +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> echo "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^^^^ source.github-actions-workflow meta.embedded.inline.batchfile keyword.command.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.begin.batchfile +# ^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.end.batchfile +> # second step. +#^^^^^^ source.github-actions-workflow punctuation.whitespace.comment.leading.yaml +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> - name: Second +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> # use job default shell. +#^^^^^^^^ source.github-actions-workflow punctuation.whitespace.comment.leading.yaml +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> print("Hello") +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python support.function.builtin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.begin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.begin.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.end.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.end.python +# ^^ source.github-actions-workflow meta.embedded.inline.python +># second job. +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> b: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> # the steps. +#^^^^ source.github-actions-workflow punctuation.whitespace.comment.leading.yaml +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> # first step. +#^^^^^^ source.github-actions-workflow punctuation.whitespace.comment.leading.yaml +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> - name: First +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> # use workflow default. +#^^^^^^^^ source.github-actions-workflow punctuation.whitespace.comment.leading.yaml +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> Write-Host "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell support.function.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell +> +#^ source.github-actions-workflow meta.embedded.inline.powershell diff --git a/language/syntaxes/test/run/composite-action.test.yml b/language/syntaxes/test/run/composite-action.test.yml new file mode 100644 index 00000000..468ef965 --- /dev/null +++ b/language/syntaxes/test/run/composite-action.test.yml @@ -0,0 +1,13 @@ +# SYNTAX TEST "source.github-actions-workflow" "`run` used in a composite action" + +name: Test + +description: Test + +runs: + using: composite + steps: + - name: Step + shell: pwsh + run: | + Write-Host "Hello" diff --git a/language/syntaxes/test/run/composite-action.test.yml.snap b/language/syntaxes/test/run/composite-action.test.yml.snap new file mode 100644 index 00000000..8dcc6893 --- /dev/null +++ b/language/syntaxes/test/run/composite-action.test.yml.snap @@ -0,0 +1,70 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "`run` used in a composite action" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>description: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>runs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> using: composite +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> steps: +#^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Step +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: pwsh +#^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> Write-Host "Hello" +#^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell support.function.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell +> +#^ source.github-actions-workflow meta.embedded.inline.powershell diff --git a/language/syntaxes/test/run/expression-in-run.test.yml b/language/syntaxes/test/run/expression-in-run.test.yml new file mode 100644 index 00000000..7810476c --- /dev/null +++ b/language/syntaxes/test/run/expression-in-run.test.yml @@ -0,0 +1,25 @@ +# SYNTAX TEST "source.github-actions-workflow" "expression used in the `run` script" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + steps: + - shell: bash + run: | + echo "${{ github.event_name }}" + + - shell: cmd + run: | + echo "${{ github.event_name }}" + + - shell: pwsh + run: | + Write-Host "${{ github.event_name }}" + + - shell: python + run: | + print("${{ github.event_name }}") diff --git a/language/syntaxes/test/run/expression-in-run.test.yml.snap b/language/syntaxes/test/run/expression-in-run.test.yml.snap new file mode 100644 index 00000000..ce02902f --- /dev/null +++ b/language/syntaxes/test/run/expression-in-run.test.yml.snap @@ -0,0 +1,152 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "expression used in the `run` script" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - shell: bash +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> echo "${{ github.event_name }}" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.shell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell punctuation.definition.string.begin.shell +# ^^^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell meta.embedded.block.github-actions-expression +# ^^^^^^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell meta.embedded.block.github-actions-expression +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell meta.embedded.block.github-actions-expression +# ^^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell punctuation.definition.string.end.shell +> +#^ source.github-actions-workflow meta.embedded.inline.shell +> - shell: cmd +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> echo "${{ github.event_name }}" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^^^^ source.github-actions-workflow meta.embedded.inline.batchfile keyword.command.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.begin.batchfile +# ^^^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile meta.embedded.block.github-actions-expression +# ^^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile meta.embedded.block.github-actions-expression +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile meta.embedded.block.github-actions-expression +# ^^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.end.batchfile +> +#^ source.github-actions-workflow meta.embedded.inline.batchfile +> - shell: pwsh +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> Write-Host "${{ github.event_name }}" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell support.function.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell +# ^^^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell meta.embedded.block.github-actions-expression +# ^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell meta.embedded.block.github-actions-expression +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell meta.embedded.block.github-actions-expression +# ^^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell +> +#^ source.github-actions-workflow meta.embedded.inline.powershell +> - shell: python +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> print("${{ github.event_name }}") +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python support.function.builtin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.begin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.begin.python +# ^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python meta.embedded.block.github-actions-expression +# ^^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python meta.embedded.block.github-actions-expression +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python meta.embedded.block.github-actions-expression variable.other.read.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python meta.embedded.block.github-actions-expression +# ^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python meta.embedded.block.github-actions-expression +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.end.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.end.python +> +#^ source.github-actions-workflow meta.embedded.inline.python diff --git a/language/syntaxes/test/run/invalid-content.test.yml b/language/syntaxes/test/run/invalid-content.test.yml new file mode 100644 index 00000000..2c5d9110 --- /dev/null +++ b/language/syntaxes/test/run/invalid-content.test.yml @@ -0,0 +1,32 @@ +# SYNTAX TEST "source.github-actions-workflow" "invalid content at the end of lines" + +name: Test + +on: + workflow_dispatch: + +defaults: invalid + run: invalid + shell: pwsh invalid + +jobs: invalid + a: invalid + defaults: invalid + run: invalid + shell: python invalid + + steps: + - name: First + shell: cmd invalid + run: | invalid + echo "Hello" + + - name: Second + run: | invalid + print("Hello") + + b: invalid + steps: invalid + - name: First + run: | invalid + Write-Host "Hello" diff --git a/language/syntaxes/test/run/invalid-content.test.yml.snap b/language/syntaxes/test/run/invalid-content.test.yml.snap new file mode 100644 index 00000000..15348086 --- /dev/null +++ b/language/syntaxes/test/run/invalid-content.test.yml.snap @@ -0,0 +1,172 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "invalid content at the end of lines" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>defaults: invalid +#^^^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^^^^^^^^ source.github-actions-workflow invalid.illegal.expected-comment-or-newline.yaml +> run: invalid +#^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^^^^^^^^ source.github-actions-workflow invalid.illegal.expected-comment-or-newline.yaml +> shell: pwsh invalid +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^ source.github-actions-workflow invalid.illegal.expected-comment-or-newline.yaml +> +#^ source.github-actions-workflow +>jobs: invalid +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^^^^^^^^ source.github-actions-workflow invalid.illegal.expected-comment-or-newline.yaml +> a: invalid +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^^^^^^^^ source.github-actions-workflow invalid.illegal.expected-comment-or-newline.yaml +> defaults: invalid +#^^^^ source.github-actions-workflow +# ^^^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^^^^^^^^ source.github-actions-workflow invalid.illegal.expected-comment-or-newline.yaml +> run: invalid +#^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^^^^^^^^ source.github-actions-workflow invalid.illegal.expected-comment-or-newline.yaml +> shell: python invalid +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^ source.github-actions-workflow invalid.illegal.expected-comment-or-newline.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: First +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: cmd invalid +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^ source.github-actions-workflow invalid.illegal.expected-comment-or-newline.yaml +> run: | invalid +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +# ^^^^^^^^ source.github-actions-workflow invalid.illegal.expected-comment-or-newline.yaml +> echo "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^^^^ source.github-actions-workflow meta.embedded.inline.batchfile keyword.command.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.begin.batchfile +# ^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.end.batchfile +> +#^ source.github-actions-workflow meta.embedded.inline.batchfile +> - name: Second +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | invalid +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +# ^^^^^^^^ source.github-actions-workflow invalid.illegal.expected-comment-or-newline.yaml +> print("Hello") +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python support.function.builtin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.begin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.begin.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.end.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.end.python +# ^^ source.github-actions-workflow meta.embedded.inline.python +> +#^ source.github-actions-workflow meta.embedded.inline.python +> b: invalid +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^^^^^^^^ source.github-actions-workflow invalid.illegal.expected-comment-or-newline.yaml +> steps: invalid +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^^^^^^^^ source.github-actions-workflow invalid.illegal.expected-comment-or-newline.yaml +> - name: First +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | invalid +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +# ^^^^^^^^ source.github-actions-workflow invalid.illegal.expected-comment-or-newline.yaml +> Write-Host "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell support.function.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell +> +#^ source.github-actions-workflow meta.embedded.inline.powershell diff --git a/language/syntaxes/test/run/job-has-default-shell.test.yml b/language/syntaxes/test/run/job-has-default-shell.test.yml new file mode 100644 index 00000000..2eed1327 --- /dev/null +++ b/language/syntaxes/test/run/job-has-default-shell.test.yml @@ -0,0 +1,35 @@ +# SYNTAX TEST "source.github-actions-workflow" "job defines a default shell" + +name: Test + +on: + workflow_dispatch: + +jobs: + a: + defaults: + run: + shell: python + + steps: + - name: Use Job Default + run: | + print("Using the job's default shell") + + - run: | # Use Job Default + print("Using the job's default shell") + + - name: Override Job Default + shell: cmd + run: | + echo "Hello" + + - shell: cmd # Override Job Default + run: | + echo "Hello" + + b: + steps: + - name: No Default + run: | + print("Default from previous job does not flow to the next job.") diff --git a/language/syntaxes/test/run/job-has-default-shell.test.yml.snap b/language/syntaxes/test/run/job-has-default-shell.test.yml.snap new file mode 100644 index 00000000..21ea62eb --- /dev/null +++ b/language/syntaxes/test/run/job-has-default-shell.test.yml.snap @@ -0,0 +1,186 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "job defines a default shell" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> a: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> defaults: +#^^^^ source.github-actions-workflow +# ^^^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> run: +#^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> shell: python +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Use Job Default +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> print("Using the job's default shell") +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python support.function.builtin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.begin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.begin.python +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.end.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.end.python +> +#^ source.github-actions-workflow meta.embedded.inline.python +> - run: | # Use Job Default +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> print("Using the job's default shell") +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python support.function.builtin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.begin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.begin.python +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.end.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.end.python +> +#^ source.github-actions-workflow meta.embedded.inline.python +> - name: Override Job Default +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: cmd +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> echo "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^^^^ source.github-actions-workflow meta.embedded.inline.batchfile keyword.command.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.begin.batchfile +# ^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.end.batchfile +> +#^ source.github-actions-workflow meta.embedded.inline.batchfile +> - shell: cmd # Override Job Default +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> echo "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^^^^ source.github-actions-workflow meta.embedded.inline.batchfile keyword.command.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.begin.batchfile +# ^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.end.batchfile +> +#^ source.github-actions-workflow meta.embedded.inline.batchfile +> b: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: No Default +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> print("Default from previous job does not flow to the next job.") +#^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +> +#^ source.github-actions-workflow string.unquoted.block.yaml diff --git a/language/syntaxes/test/run/job-has-defaults-but-no-shell.test.yml b/language/syntaxes/test/run/job-has-defaults-but-no-shell.test.yml new file mode 100644 index 00000000..e23d45db --- /dev/null +++ b/language/syntaxes/test/run/job-has-defaults-but-no-shell.test.yml @@ -0,0 +1,29 @@ +# SYNTAX TEST "source.github-actions-workflow" "job defines a `defaults` property, but does not set a default shell" + +name: Test + +on: + workflow_dispatch: + +jobs: + a: + defaults: + run: + working-directory: here + + steps: + - name: Use Job Default + run: | + print("No default shell") + + - run: | # Use Job Default + print("No default shell") + + - name: Set Shell + shell: bash + run: | + echo "Hello" + + - shell: bash # Set Shell + run: | + echo "Hello" diff --git a/language/syntaxes/test/run/job-has-defaults-but-no-shell.test.yml.snap b/language/syntaxes/test/run/job-has-defaults-but-no-shell.test.yml.snap new file mode 100644 index 00000000..c7c61de5 --- /dev/null +++ b/language/syntaxes/test/run/job-has-defaults-but-no-shell.test.yml.snap @@ -0,0 +1,148 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "job defines a `defaults` property, but does not set a default shell" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> a: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> defaults: +#^^^^ source.github-actions-workflow +# ^^^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> run: +#^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> working-directory: here +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Use Job Default +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> print("No default shell") +#^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +> +#^ source.github-actions-workflow string.unquoted.block.yaml +> - run: | # Use Job Default +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> print("No default shell") +#^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +> +#^ source.github-actions-workflow string.unquoted.block.yaml +> - name: Set Shell +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: bash +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> echo "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.shell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell punctuation.definition.string.begin.shell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell punctuation.definition.string.end.shell +> +#^ source.github-actions-workflow meta.embedded.inline.shell +> - shell: bash # Set Shell +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> echo "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.shell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell punctuation.definition.string.begin.shell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell punctuation.definition.string.end.shell +> +#^ source.github-actions-workflow meta.embedded.inline.shell diff --git a/language/syntaxes/test/run/no-shell.test.yml b/language/syntaxes/test/run/no-shell.test.yml new file mode 100644 index 00000000..3d56a01e --- /dev/null +++ b/language/syntaxes/test/run/no-shell.test.yml @@ -0,0 +1,16 @@ +# SYNTAX TEST "source.github-actions-workflow" "a shell is never defined" + +name: Test + +on: + workflow_dispatch: + +jobs: + a: + steps: + - name: Block + run: | + print("Block") + + - name: Inline + run: print("inline") diff --git a/language/syntaxes/test/run/no-shell.test.yml.snap b/language/syntaxes/test/run/no-shell.test.yml.snap new file mode 100644 index 00000000..fd2b3bcb --- /dev/null +++ b/language/syntaxes/test/run/no-shell.test.yml.snap @@ -0,0 +1,78 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "a shell is never defined" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> a: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Block +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> print("Block") +#^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +# ^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +> +#^ source.github-actions-workflow string.unquoted.block.yaml +> - name: Inline +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: print("inline") +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow diff --git a/language/syntaxes/test/run/parallel-steps.test.yml b/language/syntaxes/test/run/parallel-steps.test.yml new file mode 100644 index 00000000..5d79eb1a --- /dev/null +++ b/language/syntaxes/test/run/parallel-steps.test.yml @@ -0,0 +1,39 @@ +# SYNTAX TEST "source.github-actions-workflow" "parallel steps using `actions/github-script`" + +name: Test + +on: + workflow_dispatch: + +defaults: + run: + shell: bash + +jobs: + workflow-default: + runs-on: ubuntu-latest + + steps: + - parallel: + - name: One + run: echo "Workflow default" + + - name: Two + shell: pwsh + run: Write-Host "Step override" + + job-default: + runs-on: ubuntu-latest + + defaults: + run: + shell: python + + steps: + - parallel: + - name: One + run: print("Job default") + + - name: Two + shell: pwsh + run: Write-Host "Step override" diff --git a/language/syntaxes/test/run/parallel-steps.test.yml.snap b/language/syntaxes/test/run/parallel-steps.test.yml.snap new file mode 100644 index 00000000..a03bd04e --- /dev/null +++ b/language/syntaxes/test/run/parallel-steps.test.yml.snap @@ -0,0 +1,209 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "parallel steps using `actions/github-script`" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>defaults: +#^^^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> run: +#^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> shell: bash +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow-default: +#^^ source.github-actions-workflow +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - parallel: +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: One +#^^^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: echo "Workflow default" +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.shell +# ^^^ source.github-actions-workflow meta.embedded.inline.shell entity.name.tag.yaml +# ^ source.github-actions-workflow meta.embedded.inline.shell punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow meta.embedded.inline.shell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell punctuation.definition.string.begin.shell +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell punctuation.definition.string.end.shell +> +#^ source.github-actions-workflow meta.embedded.inline.shell +> - name: Two +#^^^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: pwsh +#^^^^^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: Write-Host "Step override" +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^ source.github-actions-workflow meta.embedded.inline.powershell entity.name.tag.yaml +# ^ source.github-actions-workflow meta.embedded.inline.powershell punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell support.function.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell +# ^^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell +> +#^ source.github-actions-workflow meta.embedded.inline.powershell +> job-default: +#^^ source.github-actions-workflow +# ^^^^^^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> runs-on: ubuntu-latest +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> defaults: +#^^^^ source.github-actions-workflow +# ^^^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> run: +#^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> shell: python +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - parallel: +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: One +#^^^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: print("Job default") +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python +# ^^^ source.github-actions-workflow meta.embedded.inline.python entity.name.tag.yaml +# ^ source.github-actions-workflow meta.embedded.inline.python punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow meta.embedded.inline.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python support.function.builtin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.begin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.begin.python +# ^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.end.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.end.python +> +#^ source.github-actions-workflow meta.embedded.inline.python +> - name: Two +#^^^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: pwsh +#^^^^^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: Write-Host "Step override" +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^ source.github-actions-workflow meta.embedded.inline.powershell entity.name.tag.yaml +# ^ source.github-actions-workflow meta.embedded.inline.powershell punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell support.function.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell +# ^^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell +> +#^ source.github-actions-workflow meta.embedded.inline.powershell diff --git a/language/syntaxes/test/run/plain-shell-bash.test.yml b/language/syntaxes/test/run/plain-shell-bash.test.yml new file mode 100644 index 00000000..949e26b8 --- /dev/null +++ b/language/syntaxes/test/run/plain-shell-bash.test.yml @@ -0,0 +1,13 @@ +# SYNTAX TEST "source.github-actions-workflow" "plain string using `bash` shell" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + steps: + - name: Test + shell: bash + run: echo "Hello" diff --git a/language/syntaxes/test/run/plain-shell-bash.test.yml.snap b/language/syntaxes/test/run/plain-shell-bash.test.yml.snap new file mode 100644 index 00000000..d846d05e --- /dev/null +++ b/language/syntaxes/test/run/plain-shell-bash.test.yml.snap @@ -0,0 +1,63 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "plain string using `bash` shell" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Test +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: bash +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: echo "Hello" +#^^^^^^^^ source.github-actions-workflow meta.embedded.inline.shell +# ^^^ source.github-actions-workflow meta.embedded.inline.shell entity.name.tag.yaml +# ^ source.github-actions-workflow meta.embedded.inline.shell punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow meta.embedded.inline.shell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell punctuation.definition.string.begin.shell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell punctuation.definition.string.end.shell +> +#^ source.github-actions-workflow meta.embedded.inline.shell diff --git a/language/syntaxes/test/run/plain-shell-cmd.test.yml b/language/syntaxes/test/run/plain-shell-cmd.test.yml new file mode 100644 index 00000000..47323b6e --- /dev/null +++ b/language/syntaxes/test/run/plain-shell-cmd.test.yml @@ -0,0 +1,13 @@ +# SYNTAX TEST "source.github-actions-workflow" "plain string using `cmd` shell" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + steps: + - name: Test + shell: cmd + run: echo "Hello" diff --git a/language/syntaxes/test/run/plain-shell-cmd.test.yml.snap b/language/syntaxes/test/run/plain-shell-cmd.test.yml.snap new file mode 100644 index 00000000..c0cd682a --- /dev/null +++ b/language/syntaxes/test/run/plain-shell-cmd.test.yml.snap @@ -0,0 +1,64 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "plain string using `cmd` shell" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Test +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: cmd +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: echo "Hello" +#^^^^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^^^ source.github-actions-workflow meta.embedded.inline.batchfile entity.name.tag.yaml +# ^ source.github-actions-workflow meta.embedded.inline.batchfile punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^^^^ source.github-actions-workflow meta.embedded.inline.batchfile keyword.command.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.begin.batchfile +# ^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.end.batchfile +> +#^ source.github-actions-workflow meta.embedded.inline.batchfile diff --git a/language/syntaxes/test/run/plain-shell-powershell.test.yml b/language/syntaxes/test/run/plain-shell-powershell.test.yml new file mode 100644 index 00000000..f290a808 --- /dev/null +++ b/language/syntaxes/test/run/plain-shell-powershell.test.yml @@ -0,0 +1,13 @@ +# SYNTAX TEST "source.github-actions-workflow" "plain string using `powershell` shell" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + steps: + - name: Test + shell: powershell + run: Write-Host "Hello" diff --git a/language/syntaxes/test/run/plain-shell-powershell.test.yml.snap b/language/syntaxes/test/run/plain-shell-powershell.test.yml.snap new file mode 100644 index 00000000..79191c82 --- /dev/null +++ b/language/syntaxes/test/run/plain-shell-powershell.test.yml.snap @@ -0,0 +1,64 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "plain string using `powershell` shell" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Test +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: powershell +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: Write-Host "Hello" +#^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^ source.github-actions-workflow meta.embedded.inline.powershell entity.name.tag.yaml +# ^ source.github-actions-workflow meta.embedded.inline.powershell punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell support.function.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell +> +#^ source.github-actions-workflow meta.embedded.inline.powershell diff --git a/language/syntaxes/test/run/plain-shell-pwsh.test.yml b/language/syntaxes/test/run/plain-shell-pwsh.test.yml new file mode 100644 index 00000000..7471e16a --- /dev/null +++ b/language/syntaxes/test/run/plain-shell-pwsh.test.yml @@ -0,0 +1,13 @@ +# SYNTAX TEST "source.github-actions-workflow" "plain string using `pwsh` shell" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + steps: + - name: Test + shell: pwsh + run: Write-Host "Hello" diff --git a/language/syntaxes/test/run/plain-shell-pwsh.test.yml.snap b/language/syntaxes/test/run/plain-shell-pwsh.test.yml.snap new file mode 100644 index 00000000..9c8f7510 --- /dev/null +++ b/language/syntaxes/test/run/plain-shell-pwsh.test.yml.snap @@ -0,0 +1,64 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "plain string using `pwsh` shell" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Test +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: pwsh +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: Write-Host "Hello" +#^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^ source.github-actions-workflow meta.embedded.inline.powershell entity.name.tag.yaml +# ^ source.github-actions-workflow meta.embedded.inline.powershell punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell support.function.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell +> +#^ source.github-actions-workflow meta.embedded.inline.powershell diff --git a/language/syntaxes/test/run/plain-shell-python.test.yml b/language/syntaxes/test/run/plain-shell-python.test.yml new file mode 100644 index 00000000..c37ced43 --- /dev/null +++ b/language/syntaxes/test/run/plain-shell-python.test.yml @@ -0,0 +1,13 @@ +# SYNTAX TEST "source.github-actions-workflow" "block scalar using `python` shell" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + steps: + - name: Test + shell: python + run: print("Hello") diff --git a/language/syntaxes/test/run/plain-shell-python.test.yml.snap b/language/syntaxes/test/run/plain-shell-python.test.yml.snap new file mode 100644 index 00000000..5d6b72b9 --- /dev/null +++ b/language/syntaxes/test/run/plain-shell-python.test.yml.snap @@ -0,0 +1,65 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "block scalar using `python` shell" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Test +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: python +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: print("Hello") +#^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python +# ^^^ source.github-actions-workflow meta.embedded.inline.python entity.name.tag.yaml +# ^ source.github-actions-workflow meta.embedded.inline.python punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow meta.embedded.inline.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python support.function.builtin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.begin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.begin.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.end.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.end.python +> +#^ source.github-actions-workflow meta.embedded.inline.python diff --git a/language/syntaxes/test/run/plain-shell-sh.test.yml b/language/syntaxes/test/run/plain-shell-sh.test.yml new file mode 100644 index 00000000..1ff3cb4f --- /dev/null +++ b/language/syntaxes/test/run/plain-shell-sh.test.yml @@ -0,0 +1,13 @@ +# SYNTAX TEST "source.github-actions-workflow" "plain string using `sh` shell" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + steps: + - name: Test + shell: sh + run: echo "Hello" diff --git a/language/syntaxes/test/run/plain-shell-sh.test.yml.snap b/language/syntaxes/test/run/plain-shell-sh.test.yml.snap new file mode 100644 index 00000000..08cc7bad --- /dev/null +++ b/language/syntaxes/test/run/plain-shell-sh.test.yml.snap @@ -0,0 +1,63 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "plain string using `sh` shell" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Test +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: sh +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: echo "Hello" +#^^^^^^^^ source.github-actions-workflow meta.embedded.inline.shell +# ^^^ source.github-actions-workflow meta.embedded.inline.shell entity.name.tag.yaml +# ^ source.github-actions-workflow meta.embedded.inline.shell punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow meta.embedded.inline.shell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell punctuation.definition.string.begin.shell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell +# ^ source.github-actions-workflow meta.embedded.inline.shell string.quoted.double.shell punctuation.definition.string.end.shell +> +#^ source.github-actions-workflow meta.embedded.inline.shell diff --git a/language/syntaxes/test/run/plain-wrapped.test.yml b/language/syntaxes/test/run/plain-wrapped.test.yml new file mode 100644 index 00000000..4c873b21 --- /dev/null +++ b/language/syntaxes/test/run/plain-wrapped.test.yml @@ -0,0 +1,16 @@ +# SYNTAX TEST "source.github-actions-workflow" "plain string wrapped over multiple lines" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + steps: + - name: Test + shell: pwsh + run: $a = @( + "Hello", + "World" + ) diff --git a/language/syntaxes/test/run/plain-wrapped.test.yml.snap b/language/syntaxes/test/run/plain-wrapped.test.yml.snap new file mode 100644 index 00000000..9b01491c --- /dev/null +++ b/language/syntaxes/test/run/plain-wrapped.test.yml.snap @@ -0,0 +1,80 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "plain string wrapped over multiple lines" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Test +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: pwsh +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: $a = @( +#^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^ source.github-actions-workflow meta.embedded.inline.powershell entity.name.tag.yaml +# ^ source.github-actions-workflow meta.embedded.inline.powershell punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell variable.other.readwrite.powershell punctuation.definition.variable.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell variable.other.readwrite.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell keyword.operator.assignment.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell meta.group.array-expression.powershell keyword.other.array.begin.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell meta.group.array-expression.powershell punctuation.section.group.begin.powershell +> "Hello", +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell meta.group.array-expression.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell meta.group.array-expression.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.powershell meta.group.array-expression.powershell string.quoted.double.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell meta.group.array-expression.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell meta.group.array-expression.powershell keyword.operator.other.powershell +> "World" +#^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell meta.group.array-expression.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell meta.group.array-expression.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.powershell meta.group.array-expression.powershell string.quoted.double.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell meta.group.array-expression.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell +> ) +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell meta.group.array-expression.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell meta.group.array-expression.powershell punctuation.section.group.end.powershell +> +#^ source.github-actions-workflow meta.embedded.inline.powershell diff --git a/language/syntaxes/test/run/properties-between-shell-and-run.test.yml b/language/syntaxes/test/run/properties-between-shell-and-run.test.yml new file mode 100644 index 00000000..96289214 --- /dev/null +++ b/language/syntaxes/test/run/properties-between-shell-and-run.test.yml @@ -0,0 +1,18 @@ +# SYNTAX TEST "source.github-actions-workflow" "other properties are defined between the `shell` and `run` properties" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + steps: + - name: Test + shell: python + env: + FOO: 1 + BAR: 2 + run: | + print("Hello") + exit(1) diff --git a/language/syntaxes/test/run/properties-between-shell-and-run.test.yml.snap b/language/syntaxes/test/run/properties-between-shell-and-run.test.yml.snap new file mode 100644 index 00000000..ed0d3bed --- /dev/null +++ b/language/syntaxes/test/run/properties-between-shell-and-run.test.yml.snap @@ -0,0 +1,93 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "other properties are defined between the `shell` and `run` properties" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Test +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: python +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> env: +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> FOO: 1 +#^^^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow constant.numeric.integer.yaml +> BAR: 2 +#^^^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow constant.numeric.integer.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> print("Hello") +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python support.function.builtin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.begin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.begin.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.end.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.end.python +> exit(1) +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python +# ^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python support.function.builtin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.begin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python constant.numeric.dec.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.end.python +> +#^ source.github-actions-workflow meta.embedded.inline.python diff --git a/language/syntaxes/test/run/run-as-input-to-action.test.yml b/language/syntaxes/test/run/run-as-input-to-action.test.yml new file mode 100644 index 00000000..14b8bc06 --- /dev/null +++ b/language/syntaxes/test/run/run-as-input-to-action.test.yml @@ -0,0 +1,20 @@ +# SYNTAX TEST "source.github-actions-workflow" "a `run` property exists, but it is an input to an action rather than a property of a step" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + defaults: + run: + shell: python + + steps: + - name: Test + uses: foo/bar@main + with: + run: | + print("Hello") + exit(1) diff --git a/language/syntaxes/test/run/run-as-input-to-action.test.yml.snap b/language/syntaxes/test/run/run-as-input-to-action.test.yml.snap new file mode 100644 index 00000000..df679cd2 --- /dev/null +++ b/language/syntaxes/test/run/run-as-input-to-action.test.yml.snap @@ -0,0 +1,88 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "a `run` property exists, but it is an input to an action rather than a property of a step" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> defaults: +#^^^^ source.github-actions-workflow +# ^^^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> run: +#^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> shell: python +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Test +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> uses: foo/bar@main +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> with: +#^^^^^^^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> run: | +#^^^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> print("Hello") +#^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +# ^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +> exit(1) +#^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +> +#^ source.github-actions-workflow string.unquoted.block.yaml diff --git a/language/syntaxes/test/run/shell-after-run.test.yml b/language/syntaxes/test/run/shell-after-run.test.yml new file mode 100644 index 00000000..d1164a09 --- /dev/null +++ b/language/syntaxes/test/run/shell-after-run.test.yml @@ -0,0 +1,19 @@ +# SYNTAX TEST "source.github-actions-workflow" "a `shell` property after a `run` property does not affect the `run` script" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + steps: + - name: Test + run: | + echo "Hello" + exit 1 + shell: bash + + - name: Test + run: | + echo "The `shell` after `run` in the previous step does not affect this step" diff --git a/language/syntaxes/test/run/shell-after-run.test.yml.snap b/language/syntaxes/test/run/shell-after-run.test.yml.snap new file mode 100644 index 00000000..55decc24 --- /dev/null +++ b/language/syntaxes/test/run/shell-after-run.test.yml.snap @@ -0,0 +1,88 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "a `shell` property after a `run` property does not affect the `run` script" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Test +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> echo "Hello" +#^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +# ^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +> exit 1 +#^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +> shell: bash +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> - name: Test +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> echo "The `shell` after `run` in the previous step does not affect this step" +#^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +> +#^ source.github-actions-workflow string.unquoted.block.yaml diff --git a/language/syntaxes/test/run/shell-as-first-property.test.yml b/language/syntaxes/test/run/shell-as-first-property.test.yml new file mode 100644 index 00000000..202bdc74 --- /dev/null +++ b/language/syntaxes/test/run/shell-as-first-property.test.yml @@ -0,0 +1,14 @@ +# SYNTAX TEST "source.github-actions-workflow" "`shell` is the first property of the step" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + steps: + - shell: pwsh + run: | + Write-Host "Hello" + exit 1 diff --git a/language/syntaxes/test/run/shell-as-first-property.test.yml.snap b/language/syntaxes/test/run/shell-as-first-property.test.yml.snap new file mode 100644 index 00000000..77905007 --- /dev/null +++ b/language/syntaxes/test/run/shell-as-first-property.test.yml.snap @@ -0,0 +1,64 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "`shell` is the first property of the step" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - shell: pwsh +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> Write-Host "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell support.function.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell +> exit 1 +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^^ source.github-actions-workflow meta.embedded.inline.powershell keyword.control.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell constant.numeric.integer.powershell +> +#^ source.github-actions-workflow meta.embedded.inline.powershell diff --git a/language/syntaxes/test/run/step-after-run.test.yml b/language/syntaxes/test/run/step-after-run.test.yml new file mode 100644 index 00000000..06324de0 --- /dev/null +++ b/language/syntaxes/test/run/step-after-run.test.yml @@ -0,0 +1,19 @@ +# SYNTAX TEST "source.github-actions-workflow" "the shell from one step does not affect the next test" + +name: Test + +on: + workflow_dispatch: + +jobs: + test: + steps: + - shell: pwsh + run: | + Write-Host "Hello" + exit 1 + + - name: Next step is unaffected by the previous step's shell + run: | + Write-Host "Hello" + exit 1 \ No newline at end of file diff --git a/language/syntaxes/test/run/step-after-run.test.yml.snap b/language/syntaxes/test/run/step-after-run.test.yml.snap new file mode 100644 index 00000000..c955841f --- /dev/null +++ b/language/syntaxes/test/run/step-after-run.test.yml.snap @@ -0,0 +1,86 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "the shell from one step does not affect the next test" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> test: +#^^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - shell: pwsh +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> Write-Host "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell support.function.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell +# ^^^^^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell +> exit 1 +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^^ source.github-actions-workflow meta.embedded.inline.powershell keyword.control.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell constant.numeric.integer.powershell +> +#^ source.github-actions-workflow meta.embedded.inline.powershell +> - name: Next step is unaffected by the previous step's shell +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> Write-Host "Hello" +#^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +# ^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +> exit 1 +#^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml diff --git a/language/syntaxes/test/run/workflow-has-default-shell.test.yml b/language/syntaxes/test/run/workflow-has-default-shell.test.yml new file mode 100644 index 00000000..d3f23cc4 --- /dev/null +++ b/language/syntaxes/test/run/workflow-has-default-shell.test.yml @@ -0,0 +1,35 @@ +# SYNTAX TEST "source.github-actions-workflow" "workflow defines a default shell" + +name: Test + +on: + workflow_dispatch: + +defaults: + run: + shell: python + +jobs: + a: + steps: + - name: Use Workflow Default + run: | + print("Using the workflow's default shell") + + - run: | # Use Workflow Default + print("Using the workflow's default shell") + + - name: Override Workflow Default + shell: cmd + run: | + echo "Hello" + + - shell: cmd # Override Workflow Default + run: | + echo "Hello" + + b: + steps: + - name: Workflow Default Applies To All Jobs + run: | + print("Using the workflow's default shell") diff --git a/language/syntaxes/test/run/workflow-has-default-shell.test.yml.snap b/language/syntaxes/test/run/workflow-has-default-shell.test.yml.snap new file mode 100644 index 00000000..54fc99d3 --- /dev/null +++ b/language/syntaxes/test/run/workflow-has-default-shell.test.yml.snap @@ -0,0 +1,189 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "workflow defines a default shell" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>defaults: +#^^^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> run: +#^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> shell: python +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> a: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Use Workflow Default +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> print("Using the workflow's default shell") +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python support.function.builtin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.begin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.begin.python +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.end.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.end.python +> +#^ source.github-actions-workflow meta.embedded.inline.python +> - run: | # Use Workflow Default +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> print("Using the workflow's default shell") +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python support.function.builtin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.begin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.begin.python +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.end.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.end.python +> +#^ source.github-actions-workflow meta.embedded.inline.python +> - name: Override Workflow Default +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: cmd +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> echo "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^^^^ source.github-actions-workflow meta.embedded.inline.batchfile keyword.command.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.begin.batchfile +# ^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.end.batchfile +> +#^ source.github-actions-workflow meta.embedded.inline.batchfile +> - shell: cmd # Override Workflow Default +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> echo "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^^^^ source.github-actions-workflow meta.embedded.inline.batchfile keyword.command.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.begin.batchfile +# ^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.end.batchfile +> +#^ source.github-actions-workflow meta.embedded.inline.batchfile +> b: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Workflow Default Applies To All Jobs +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> print("Using the workflow's default shell") +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python support.function.builtin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.begin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.begin.python +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.end.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.end.python +> +#^ source.github-actions-workflow meta.embedded.inline.python diff --git a/language/syntaxes/test/run/workflow-has-defaults-but-no-shell.test.yml b/language/syntaxes/test/run/workflow-has-defaults-but-no-shell.test.yml new file mode 100644 index 00000000..d39c6f7d --- /dev/null +++ b/language/syntaxes/test/run/workflow-has-defaults-but-no-shell.test.yml @@ -0,0 +1,29 @@ +# SYNTAX TEST "source.github-actions-workflow" "workflow defines a `defaults` property, but does not set a default shell" + +name: Test + +on: + workflow_dispatch: + +defaults: + run: + working-directory: here + +jobs: + a: + steps: + - name: Use Workflow Default + run: | + print("No default shell") + + - run: | # Use Workflow Default + print("No default shell") + + - name: Set Shell + shell: cmd + run: | + echo "Hello" + + - shell: cmd # Set Shell + run: | + echo "Hello" diff --git a/language/syntaxes/test/run/workflow-has-defaults-but-no-shell.test.yml.snap b/language/syntaxes/test/run/workflow-has-defaults-but-no-shell.test.yml.snap new file mode 100644 index 00000000..a3d502e4 --- /dev/null +++ b/language/syntaxes/test/run/workflow-has-defaults-but-no-shell.test.yml.snap @@ -0,0 +1,149 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "workflow defines a `defaults` property, but does not set a default shell" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>defaults: +#^^^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> run: +#^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> working-directory: here +#^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> a: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Use Workflow Default +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> print("No default shell") +#^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +> +#^ source.github-actions-workflow string.unquoted.block.yaml +> - run: | # Use Workflow Default +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> print("No default shell") +#^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.block.yaml +> +#^ source.github-actions-workflow string.unquoted.block.yaml +> - name: Set Shell +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: cmd +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> echo "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^^^^ source.github-actions-workflow meta.embedded.inline.batchfile keyword.command.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.begin.batchfile +# ^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.end.batchfile +> +#^ source.github-actions-workflow meta.embedded.inline.batchfile +> - shell: cmd # Set Shell +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> echo "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^^^^ source.github-actions-workflow meta.embedded.inline.batchfile keyword.command.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.begin.batchfile +# ^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.end.batchfile +> +#^ source.github-actions-workflow meta.embedded.inline.batchfile diff --git a/language/syntaxes/test/run/workflow-has-defaults-shell-and-job-has-default-shell.test.yml b/language/syntaxes/test/run/workflow-has-defaults-shell-and-job-has-default-shell.test.yml new file mode 100644 index 00000000..98d153f2 --- /dev/null +++ b/language/syntaxes/test/run/workflow-has-defaults-shell-and-job-has-default-shell.test.yml @@ -0,0 +1,39 @@ +# SYNTAX TEST "source.github-actions-workflow" "workflow defines a default shell and a job defines a default shell" + +name: Test + +on: + workflow_dispatch: + +defaults: + run: + shell: python + +jobs: + a: + defaults: + run: + shell: pwsh + + steps: + - name: Use Job Default + run: | + Write-Host "Using the job's default shell" + + - run: | # Use Job Default + Write-Host "Using the job's default shell" + + - name: Override Job Default + shell: cmd + run: | + echo "Hello" + + - shell: cmd # Override Job Default + run: | + echo "Hello" + + b: + steps: + - name: Use Workflow Default + run: | + print("Using the workflow's default shell") diff --git a/language/syntaxes/test/run/workflow-has-defaults-shell-and-job-has-default-shell.test.yml.snap b/language/syntaxes/test/run/workflow-has-defaults-shell-and-job-has-default-shell.test.yml.snap new file mode 100644 index 00000000..103920b3 --- /dev/null +++ b/language/syntaxes/test/run/workflow-has-defaults-shell-and-job-has-default-shell.test.yml.snap @@ -0,0 +1,203 @@ +# SYNTAX TEST "source.github-actions-workflow" "autogenerated snapshot test" +># SYNTAX TEST "source.github-actions-workflow" "workflow defines a default shell and a job defines a default shell" +#^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> +#^ source.github-actions-workflow +>name: Test +#^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>on: +#^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> workflow_dispatch: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> +#^ source.github-actions-workflow +>defaults: +#^^^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> run: +#^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> shell: python +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +>jobs: +#^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> a: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> defaults: +#^^^^ source.github-actions-workflow +# ^^^^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> run: +#^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> shell: pwsh +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> +#^ source.github-actions-workflow +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Use Job Default +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> Write-Host "Using the job's default shell" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell support.function.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell +> +#^ source.github-actions-workflow meta.embedded.inline.powershell +> - run: | # Use Job Default +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> Write-Host "Using the job's default shell" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell +# ^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell support.function.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.begin.powershell +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell +# ^ source.github-actions-workflow meta.embedded.inline.powershell string.quoted.double.powershell punctuation.definition.string.end.powershell +> +#^ source.github-actions-workflow meta.embedded.inline.powershell +> - name: Override Job Default +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> shell: cmd +#^^^^^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> echo "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^^^^ source.github-actions-workflow meta.embedded.inline.batchfile keyword.command.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.begin.batchfile +# ^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.end.batchfile +> +#^ source.github-actions-workflow meta.embedded.inline.batchfile +> - shell: cmd # Override Job Default +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow comment.line.number-sign.yaml punctuation.definition.comment.yaml +# ^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow comment.line.number-sign.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> echo "Hello" +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^^^^ source.github-actions-workflow meta.embedded.inline.batchfile keyword.command.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.begin.batchfile +# ^^^^^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile +# ^ source.github-actions-workflow meta.embedded.inline.batchfile string.quoted.double.batchfile punctuation.definition.string.end.batchfile +> +#^ source.github-actions-workflow meta.embedded.inline.batchfile +> b: +#^^ source.github-actions-workflow +# ^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> steps: +#^^^^ source.github-actions-workflow +# ^^^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +> - name: Use Workflow Default +#^^^^^^ source.github-actions-workflow +# ^ source.github-actions-workflow punctuation.definition.block.sequence.item.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^^^ source.github-actions-workflow string.unquoted.plain.out.yaml entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow string.unquoted.plain.out.yaml +# ^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow string.unquoted.plain.out.yaml +> run: | +#^^^^^^^^ source.github-actions-workflow +# ^^^ source.github-actions-workflow entity.name.tag.yaml +# ^ source.github-actions-workflow punctuation.separator.key-value.mapping.yaml +# ^ source.github-actions-workflow +# ^ source.github-actions-workflow keyword.control.flow.block-scalar.literal.yaml +> print("Using the workflow's default shell") +#^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python +# ^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python support.function.builtin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.begin.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.begin.python +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python meta.function-call.arguments.python string.quoted.single.python punctuation.definition.string.end.python +# ^ source.github-actions-workflow meta.embedded.inline.python meta.function-call.python punctuation.definition.arguments.end.python +> +#^ source.github-actions-workflow meta.embedded.inline.python From dba255fcca02f914eb62662820691deabd8f07cd Mon Sep 17 00:00:00 2001 From: reduckted Date: Sun, 16 Aug 2026 19:38:47 +1000 Subject: [PATCH 9/9] Added diagnostics to advise on how to use `shell` properties. --- src/extension.ts | 3 + src/shell/index.ts | 126 ++++++++ src/shell/shellAnalyzer.test.ts | 526 ++++++++++++++++++++++++++++++++ src/shell/shellAnalyzer.ts | 279 +++++++++++++++++ 4 files changed, 934 insertions(+) create mode 100644 src/shell/index.ts create mode 100644 src/shell/shellAnalyzer.test.ts create mode 100644 src/shell/shellAnalyzer.ts diff --git a/src/extension.ts b/src/extension.ts index be9a157f..c6e7bf68 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -35,6 +35,7 @@ import {initTreeViews} from "./treeViews/treeViews"; import {deactivateLanguageServer, initLanguageServer} from "./workflow/languageServer"; import {registerSignIn} from "./commands/signIn"; import {registerDebugger, registerDebuggerAvailabilityGuard} from "./debugger/debugger"; +import {registerShellDiagnostics} from "./shell"; export async function activate(context: vscode.ExtensionContext) { initLogger(); @@ -95,6 +96,8 @@ export async function activate(context: vscode.ExtensionContext) { registerSignIn(context); registerDebuggerAvailabilityGuard(context); + registerShellDiagnostics(context); + // Debugger — only available in Desktop VS Code (requires Node.js for WebSocket) if (debuggerEnabled) { registerDebugger(context); diff --git a/src/shell/index.ts b/src/shell/index.ts new file mode 100644 index 00000000..d1820c19 --- /dev/null +++ b/src/shell/index.ts @@ -0,0 +1,126 @@ +import * as vscode from "vscode"; +import * as path from "path"; +import {NoOperationTraceWriter, parseWorkflow, TemplateParseResult} from "@actions/workflow-parser"; +import {parseAction} from "@actions/workflow-parser/actions/index"; +import {ShellAnalyzer} from "./shellAnalyzer"; + +const documents: Map = new Map(); + +export function registerShellDiagnostics(context: vscode.ExtensionContext) { + const diagnostics = vscode.languages.createDiagnosticCollection("GitHub Actions"); + + context.subscriptions.push( + diagnostics, + vscode.workspace.onDidOpenTextDocument(document => onDidOpenTextDocument(document, diagnostics)), + vscode.workspace.onDidCloseTextDocument(document => onDidCloseTextDocument(document, diagnostics)), + vscode.workspace.onDidChangeTextDocument(event => onDidChangeTextDocument(event, diagnostics)) + ); + + if (vscode.window.activeTextEditor?.document) { + onDidOpenTextDocument(vscode.window.activeTextEditor.document, diagnostics); + } +} + +function onDidOpenTextDocument(document: vscode.TextDocument, diagnostics: vscode.DiagnosticCollection): void { + if (isWorkflowOrAction(document)) { + scheduleAnalysis(document, diagnostics); + } +} + +function onDidCloseTextDocument(document: vscode.TextDocument, diagnostics: vscode.DiagnosticCollection): void { + if (isWorkflowOrAction(document)) { + // Clear the diagnostics for the file because they're + // only useful if you actually have the file open. + diagnostics.set(document.uri, []); + + const info = documents.get(document); + if (info) { + info.cancelled = true; + + if (info.debounceTimer) { + clearTimeout(info.debounceTimer); + } + + documents.delete(document); + } + } +} + +function onDidChangeTextDocument( + event: vscode.TextDocumentChangeEvent, + diagnostics: vscode.DiagnosticCollection +): void { + if (isWorkflowOrAction(event.document)) { + scheduleAnalysis(event.document, diagnostics); + } +} + +function isWorkflowOrAction(document: vscode.TextDocument): boolean { + return document.languageId === "github-actions-workflow"; +} + +function scheduleAnalysis(document: vscode.TextDocument, diagnostics: vscode.DiagnosticCollection): void { + const info = getOrCreateDocumentInfo(document); + + // Restart the debounce timer. + if (info.debounceTimer) { + clearTimeout(info.debounceTimer); + } + + info.debounceTimer = setTimeout(() => { + info.debounceTimer = undefined; + if (!info.cancelled) { + analyzeShell(info, diagnostics); + } + }, 1000); +} + +function getOrCreateDocumentInfo(document: vscode.TextDocument): DocumentInfo { + let info = documents.get(document); + + if (!info) { + info = {document}; + documents.set(document, info); + } + + return info; +} + +function analyzeShell(documentInfo: DocumentInfo, diagnostics: vscode.DiagnosticCollection): void { + const contents = parseDocument(documentInfo.document); + + if (documentInfo.cancelled) { + return; + } + + diagnostics.set( + documentInfo.document.uri, + new ShellAnalyzer() + .analyze(contents?.value) + .map( + d => + new vscode.Diagnostic( + new vscode.Range(d.startLine, d.startColumn, d.endLine, d.endColumn), + d.message, + vscode.DiagnosticSeverity.Information + ) + ) + ); +} + +function parseDocument(document: vscode.TextDocument): TemplateParseResult | undefined { + const name = path.basename(document.uri.fsPath); + const parser = /action\.ya?ml$/.test(name) ? parseAction : parseWorkflow; + + try { + return parser({name, content: document.getText()}, new NoOperationTraceWriter()); + } catch { + return undefined; + } +} + +interface DocumentInfo { + readonly document: vscode.TextDocument; + debounceTimer?: ReturnType; + cancelled?: boolean; +} diff --git a/src/shell/shellAnalyzer.test.ts b/src/shell/shellAnalyzer.test.ts new file mode 100644 index 00000000..0c31e56f --- /dev/null +++ b/src/shell/shellAnalyzer.test.ts @@ -0,0 +1,526 @@ +import {ShellAnalyzer} from "./shellAnalyzer"; +import {TokenType} from "@actions/workflow-parser/templates/tokens/types"; +import {NoOperationTraceWriter, parseWorkflow, TemplateParseResult} from "@actions/workflow-parser"; +import {TemplateToken} from "@actions/workflow-parser/templates/tokens/template-token"; +import {parseAction} from "@actions/workflow-parser/actions/index"; + +describe("ShellAnalyzer", () => { + let analyzer: ShellAnalyzer; + + beforeEach(() => { + analyzer = new ShellAnalyzer(); + }); + + describe("empty workflows", () => { + it("returns empty array for undefined workflow", () => { + expect(analyzer.analyze(undefined)).toEqual([]); + }); + + it("returns empty array for non-mapping token", () => { + const workflow = createWorkflow(` + - foo + - bar + `); + + expect(workflow.templateTokenType).toBe(TokenType.Sequence); + expect(analyzer.analyze(workflow)).toEqual([]); + }); + + it("returns empty array for workflow with no jobs or defaults", () => { + const workflow = createWorkflow(` + name: Test + `); + + expect(analyzer.analyze(workflow)).toEqual([]); + }); + }); + + describe("workflow defaults shell", () => { + it("no diagnostic when shell is defined before jobs", () => { + const workflow = createWorkflow(` + name: Test + + on: workflow_dispatch + + defaults: + run: + shell: bash + + jobs: + job: + steps: + - uses: foo/bar@main + `); + + expect(analyzer.analyze(workflow)).toEqual([]); + }); + + it("no diagnostic when defaults are defined after jobs but have no shell", () => { + const workflow = createWorkflow(` + name: Test + + on: workflow_dispatch + + jobs: + job: + steps: + - uses: foo/bar@main + + defaults: + run: + working-directory: here + `); + + expect(analyzer.analyze(workflow)).toEqual([]); + }); + + it("creates diagnostic when shell is defined after jobs", () => { + const workflow = createWorkflow(` + name: Test + + on: workflow_dispatch + + jobs: + job: + steps: + - uses: foo/bar@main + + defaults: + run: + shell: bash + `); + + expect(analyzer.analyze(workflow)).toEqual([ + { + startLine: 11, + startColumn: 4, + endLine: 11, + endColumn: 9, + message: "Define the workflow's defaults before the jobs to enable script syntax highlighting." + } + ]); + }); + }); + + describe("job defaults shell", () => { + it("no diagnostic when shell is defined before steps", () => { + const workflow = createWorkflow(` + name: Test + + on: workflow_dispatch + + jobs: + job: + defaults: + run: + shell: bash + + steps: + - uses: foo/bar@main + `); + + expect(analyzer.analyze(workflow)).toEqual([]); + }); + + it("no diagnostic when defaults are defined after steps but have no shell", () => { + const workflow = createWorkflow(` + name: Test + + on: workflow_dispatch + + jobs: + job: + steps: + - uses: foo/bar@main + + defaults: + run: + working-directory: here + `); + + expect(analyzer.analyze(workflow)).toEqual([]); + }); + + it("creates diagnostic when shell is defined after steps", () => { + const workflow = createWorkflow(` + name: Test + + on: workflow_dispatch + + jobs: + job: + steps: + - uses: foo/bar@main + + defaults: + run: + shell: bash + `); + + expect(analyzer.analyze(workflow)).toEqual([ + { + startLine: 11, + startColumn: 8, + endLine: 11, + endColumn: 13, + message: "Define the job's defaults before the steps to enable script syntax highlighting." + } + ]); + }); + + it("analyzes multiple jobs", () => { + const workflow = createWorkflow(` + name: Test + + on: workflow_dispatch + + jobs: + a: + steps: + - uses: foo/bar@main + + defaults: + run: + shell: bash + + b: + steps: + - uses: foo/bar@main + + defaults: + run: + shell: bash + `); + + expect(analyzer.analyze(workflow)).toEqual([ + { + startLine: 11, + startColumn: 8, + endLine: 11, + endColumn: 13, + message: "Define the job's defaults before the steps to enable script syntax highlighting." + }, + { + startLine: 19, + startColumn: 8, + endLine: 19, + endColumn: 13, + message: "Define the job's defaults before the steps to enable script syntax highlighting." + } + ]); + }); + }); + + describe("step shell", () => { + it("no diagnostic when shell is defined before run", () => { + const workflow = createWorkflow(` + name: Test + + on: workflow_dispatch + + jobs: + a: + steps: + - shell: bash + run: exit 0 + `); + + expect(analyzer.analyze(workflow)).toEqual([]); + }); + + it("no diagnostic when job has default shell", () => { + const workflow = createWorkflow(` + name: Test + + on: workflow_dispatch + + jobs: + a: + defaults: + run: + shell: bash + + steps: + - run: exit 0 + `); + + expect(analyzer.analyze(workflow)).toEqual([]); + }); + + it("no diagnostic when workflow has default shell", () => { + const workflow = createWorkflow(` + name: Test + + on: workflow_dispatch + + defaults: + run: + shell: bash + + jobs: + a: + steps: + - run: exit 0 + `); + + expect(analyzer.analyze(workflow)).toEqual([]); + }); + + it("no diagnostic when workflow and job have default shell", () => { + const workflow = createWorkflow(` + name: Test + + on: workflow_dispatch + + defaults: + run: + shell: bash + + jobs: + a: + defaults: + run: + shell: sh + + steps: + - run: exit 0 + `); + + expect(analyzer.analyze(workflow)).toEqual([]); + }); + + it("creates diagnostic when shell is defined after run", () => { + const workflow = createWorkflow(` + name: Test + + on: workflow_dispatch + + defaults: + run: + shell: bash + + jobs: + a: + defaults: + run: + shell: sh + + steps: + - run: exit 0 + shell: bash + `); + + expect(analyzer.analyze(workflow)).toEqual([ + { + startLine: 16, + startColumn: 8, + endLine: 16, + endColumn: 13, + message: "Define the shell property before the run property to enable script syntax highlighting." + } + ]); + }); + + it("creates diagnostic when shell is not defined", () => { + const workflow = createWorkflow(` + name: Test + + on: workflow_dispatch + + jobs: + a: + steps: + - run: exit 0 + `); + + expect(analyzer.analyze(workflow)).toEqual([ + { + startLine: 7, + startColumn: 8, + endLine: 7, + endColumn: 11, + message: "Add a shell property to enable script syntax highlighting." + } + ]); + }); + + it("no diagnostic when step has no run property", () => { + const workflow = createWorkflow(` + name: Test + + on: workflow_dispatch + + jobs: + a: + steps: + - uses: foo/bar@main + `); + + expect(analyzer.analyze(workflow)).toEqual([]); + }); + + it("analyzes multiple steps", () => { + const workflow = createWorkflow(` + name: Test + + on: workflow_dispatch + + jobs: + a: + steps: + - run: exit 0 + - run: exit 0 + `); + + expect(analyzer.analyze(workflow)).toEqual([ + { + startLine: 7, + startColumn: 8, + endLine: 7, + endColumn: 11, + message: "Add a shell property to enable script syntax highlighting." + }, + { + startLine: 8, + startColumn: 8, + endLine: 8, + endColumn: 11, + message: "Add a shell property to enable script syntax highlighting." + } + ]); + }); + + it("analyzes parallel steps", () => { + const workflow = createWorkflow(` + name: Test + + on: workflow_dispatch + + jobs: + a: + steps: + - shell: bash + run: exit 0 + + - parallel: + - name: One + run: exit 0 + + - name: Two + run: exit 0 + shell: bash + + - name: Build docs + run: exit 0 + shell: bash + `); + + expect(analyzer.analyze(workflow)).toEqual([ + { + startLine: 12, + startColumn: 10, + endLine: 12, + endColumn: 13, + message: "Add a shell property to enable script syntax highlighting." + }, + { + startLine: 16, + startColumn: 10, + endLine: 16, + endColumn: 15, + message: "Define the shell property before the run property to enable script syntax highlighting." + }, + { + startLine: 20, + startColumn: 8, + endLine: 20, + endColumn: 13, + message: "Define the shell property before the run property to enable script syntax highlighting." + } + ]); + }); + }); + + describe("composite actions", () => { + it("no diagnostic when shell is before run", () => { + const workflow = createAction(` + name: Test + + description: Test + + runs: + using: composite + steps: + - name: Step + shell: bash + runs: exit 0 + `); + + expect(analyzer.analyze(workflow)).toEqual([]); + }); + + it("creates diagnostic when shell is after run", () => { + const workflow = createAction(` + name: Test + + description: Test + + runs: + using: composite + steps: + - name: Step + run: exit 0 + shell: bash + `); + + expect(analyzer.analyze(workflow)).toEqual([ + { + startLine: 9, + startColumn: 6, + endLine: 9, + endColumn: 11, + message: "Define the shell property before the run property to enable script syntax highlighting." + } + ]); + }); + }); +}); + +function createWorkflow(content: string): TemplateToken { + const result = parseWorkflow({name: "workflow.yml", content: dedent(content)}, new NoOperationTraceWriter()); + + if (result?.value) { + return result.value; + } + + throw newParseError("Failed to parse workflow", result); +} + +function createAction(content: string): TemplateToken { + const result = parseAction({name: "action.yml", content: dedent(content)}, new NoOperationTraceWriter()); + + if (result?.value) { + return result.value; + } + + throw newParseError("Failed to parse action", result); +} + +function dedent(content: string): string { + // Find the indent from the first non-blank line. The content + // probably starts with a blank line, so we ignore that line. + const indent = content.match(/^( +)/gm)?.[1].length ?? 0; + + // Trim that number of spaces from the start of each + // line, then trim the start so that we get rid of + // the blank line that probably starts the content. + return content.replace(new RegExp(`^ {${indent}}`, "gm"), "").trimStart(); +} + +function newParseError(message: string, result: TemplateParseResult): Error { + if (result.context.errors.count > 0) { + throw new Error([`${message}: `, ...result.context.errors.getErrors().map(x => x.rawMessage)].join("\n")); + } else { + throw new Error(message); + } +} diff --git a/src/shell/shellAnalyzer.ts b/src/shell/shellAnalyzer.ts new file mode 100644 index 00000000..17b937c8 --- /dev/null +++ b/src/shell/shellAnalyzer.ts @@ -0,0 +1,279 @@ +import {MappingToken} from "@actions/workflow-parser/templates/tokens/mapping-token"; +import {TemplateToken} from "@actions/workflow-parser/templates/tokens/template-token"; +import {TokenType} from "@actions/workflow-parser/templates/tokens/types"; +import {TokenRange} from "@actions/workflow-parser/templates/tokens/token-range"; +import {SequenceToken} from "@actions/workflow-parser/templates/tokens/sequence-token"; +import {StringToken} from "@actions/workflow-parser/templates/tokens/string-token"; + +export class ShellAnalyzer { + public analyze(root: TemplateToken | undefined): ShellDiagnostic[] { + const state: WorkflowState = { + visitedJobs: false, + defaultShell: undefined, + diagnostics: [] + }; + + if (root !== undefined && isMapping(root)) { + for (const item of root) { + switch (item.key.toString()) { + case "defaults": + this.visitWorkflowDefaults(item.value, state); + break; + + case "jobs": + this.visitJobs(item.value, state); + state.visitedJobs = true; + break; + + case "runs": + this.visitCompositeActionRuns(item.value, state); + break; + } + } + } + + return state.diagnostics; + } + + private visitWorkflowDefaults(defaults: TemplateToken, state: WorkflowState): void { + if (!isMapping(defaults)) { + return undefined; + } + + for (const item of defaults) { + if (item.key.toString() === "run") { + this.visitWorkflowDefaultsRun(item.value, state); + return; + } + } + } + + private visitWorkflowDefaultsRun(run: TemplateToken, state: WorkflowState): void { + if (!isMapping(run)) { + return; + } + + for (const item of run) { + if (item.key.toString() === "shell") { + if (state.visitedJobs) { + // We've already visited the jobs, so the workflow's defaults are + // defined after the jobs, which means the default shell won't + // be used for syntax highlighting. Add a diagnostic about that. + if (item.key.range) { + state.diagnostics.push( + createDiagnostic( + item.key.range, + "Define the workflow's defaults before the jobs to enable script syntax highlighting." + ) + ); + } + } + + state.defaultShell = isString(item.value) ? item.value.value : "?"; + return; + } + } + } + + private visitJobs(jobs: TemplateToken, state: WorkflowState): void { + if (!isMapping(jobs)) { + return; + } + + for (const item of jobs) { + if (isMapping(item.value)) { + this.visitJob(item.value, state); + } + } + } + + private visitJob(job: TemplateToken, state: WorkflowState): void { + if (!isMapping(job)) { + return; + } + + const jobState: JobState = { + visitedSteps: false, + defaultShell: state.defaultShell, + diagnostics: state.diagnostics + }; + + for (const item of job) { + switch (item.key.toString()) { + case "defaults": + this.visitJobDefaults(item.value, jobState); + break; + + case "steps": + this.visitSteps(item.value, jobState); + jobState.visitedSteps = true; + break; + } + } + } + + private visitJobDefaults(defaults: TemplateToken, state: JobState): void { + if (!isMapping(defaults)) { + return; + } + + for (const item of defaults) { + if (item.key.toString() === "run") { + this.visitJobDefaultsRun(item.value, state); + return; + } + } + } + + private visitJobDefaultsRun(run: TemplateToken, state: JobState): void { + if (!isMapping(run)) { + return; + } + + for (const item of run) { + if (item.key.toString() === "shell") { + if (state.visitedSteps) { + // We've already visited the steps, so the job's defaults are + // defined after the steps, which means the default shell won't + // be used for syntax highlighting. Add a diagnostic about that. + if (item.key.range) { + state.diagnostics.push( + createDiagnostic( + item.key.range, + "Define the job's defaults before the steps to enable script syntax highlighting." + ) + ); + } + } + + state.defaultShell = isString(item.value) ? item.value.value : "?"; + return; + } + } + } + + private visitCompositeActionRuns(runs: TemplateToken, state: WorkflowState): void { + if (!isMapping(runs)) { + return; + } + + for (const item of runs) { + if (item.key.toString() === "steps") { + this.visitSteps(item.value, { + diagnostics: state.diagnostics, + defaultShell: undefined + }); + return; + } + } + } + + private visitSteps(steps: TemplateToken, state: StepsState): void { + if (!isSequence(steps)) { + return; + } + + for (const item of steps) { + this.visitStep(item, state); + } + } + + private visitStep(step: TemplateToken, state: StepsState): void { + if (!isMapping(step)) { + return; + } + + let run: TemplateToken | undefined; + + for (const item of step) { + switch (item.key.toString()) { + case "parallel": + this.visitSteps(item.value, state); + break; + + case "shell": + if (run) { + // We've already seen the run property, so the shell is defined + // after the script, which means the shell won't be used for + // syntax highlighting. Add a diagnostic about that. + if (item.key.range) { + state.diagnostics.push( + createDiagnostic( + item.key.range, + "Define the shell property before the run property to enable script syntax highlighting." + ) + ); + } + } + + // A shell is defined for the step, so we don't have to add a + // diagnostic explaining that a shell property will enable syntax + // highlighting. We don't need to look at the rest of the step. + return; + + case "run": + // Just remember the step property here. If there is no shell + // defined in the step, and there is no default, then we'll + // add a diagnostic, but we need to see the rest of the + // properties in the step first. If there's a shell after + // the run property, then we'll add a different diagnostic. + run = item.key; + break; + } + } + + if (run?.range && state.defaultShell === undefined) { + // The step has a run property, but no shell + // and no default is defined. Add a diagnostic. + state.diagnostics.push(createDiagnostic(run.range, "Add a shell property to enable script syntax highlighting.")); + } + } +} + +function isMapping(token: TemplateToken): token is MappingToken { + return token.templateTokenType === TokenType.Mapping; +} + +function isSequence(token: TemplateToken): token is SequenceToken { + return token.templateTokenType === TokenType.Sequence; +} + +function isString(token: TemplateToken): token is StringToken { + return token.templateTokenType === TokenType.String; +} + +function createDiagnostic(tokenRange: TokenRange, message: string): ShellDiagnostic { + // Token ranges are one-based, but VS Code ranges are zero-based. + return { + startLine: tokenRange.start.line - 1, + startColumn: tokenRange.start.column - 1, + endLine: tokenRange.end.line - 1, + endColumn: tokenRange.end.column - 1, + message + }; +} + +interface WorkflowState { + readonly diagnostics: ShellDiagnostic[]; + visitedJobs: boolean; + defaultShell: string | undefined; +} + +interface JobState { + readonly diagnostics: ShellDiagnostic[]; + visitedSteps: boolean; + defaultShell: string | undefined; +} + +interface StepsState { + readonly diagnostics: ShellDiagnostic[]; + defaultShell: string | undefined; +} + +export interface ShellDiagnostic { + readonly startLine: number; + readonly startColumn: number; + readonly endLine: number; + readonly endColumn: number; + readonly message: string; +}