vscode-github-actions
vscode-github-actions copied to clipboard
Add support for embedding languages for the `runs` keyword
Is your feature request related to a problem? Please describe. Not specifically.
Describe the solution you'd like
I would like to see my step runs show the correct syntax when I'm editing GH Actions or Workflows. Thank you!
Additional context
IntelliJ supports this via a feature called Language Injection. Users can either add a comment before the key such as # language=sh or modify their JSON Schema to provide the "x-intellij-language-injection": "Shell Script" property.
For VSCode, a request for generic support didn't gain much traction. Based on the discussion in microsoft/vscode#1751 it seems the preferred way to do this is with an extension using Grammar Injection or Embedded Languages.
Complementing OP's request: it would be great to support several "languages embedded in YAML":
- Shell script in a
run:block - JavaScript in a
uses: actions/github-script@v7block
And "Support" means:
- Syntax highlighting
- Checking (e.g. via Shellcheck for Shell, and via tsserver for JavaScript)
Somewhat related proposal: https://github.com/microsoft/vscode/issues/224581
In the mean time, there is an extension which provides YAML blocks syntax highlighting: https://github.com/harrydowning/yaml-embedded-languages
Still not practical in this case as we would have to tag each run: | block with its corresponding language, like:
- shell: python
- run:| # python
print("Yo!")