vscode-github-actions icon indicating copy to clipboard operation
vscode-github-actions copied to clipboard

Add support for embedding languages for the `runs` keyword

Open dekimsey opened this issue 2 years ago • 3 comments
trafficstars

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.

dekimsey avatar Oct 11 '23 17:10 dekimsey

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@v7 block

And "Support" means:

  • Syntax highlighting
  • Checking (e.g. via Shellcheck for Shell, and via tsserver for JavaScript)

ronjouch avatar Dec 13 '23 13:12 ronjouch

Somewhat related proposal: https://github.com/microsoft/vscode/issues/224581

voxpelli avatar Aug 02 '24 12:08 voxpelli

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!") 

kdeldycke avatar Aug 02 '24 13:08 kdeldycke