redhat-developer / redhat-developer/vscode-yaml
Syntax highlight for multiline string filled with code
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 829
- Forks
- 260
- Avg merge
- 5h 43m
- Merged PRs (30d)
- 1
Description
Is your enhancement related to a problem? Please describe.
It's pretty common to use a YAML file having a multiline string filled with code.
For instance, when is working with GitHub Actions, the run field can be filled with a shell script code:
jobs:
example:
runs-on: ubuntu-20.04
steps:
- name: Blah
run: |
echo "foo"
echo "bar"
But since there is no way to use this extension and have syntax highlight on this part, it became monochrome.
It's okayish for simple code, but it makes harder to read a more complex code:

Describe the solution you would like
We can read the first line for a multiline string and check if there is a shebang.
If there is one, it imports the syntax highlight for the given language.
jobs:
example:
runs-on: ubuntu-20.04
steps:
- name: Blah
run: |
#!/bin/sh
# from now on, this multiline string is syntax highlighted with the shell script grammar
echo "foo"
echo "bar"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named in the issue. Start by locating the YAML multiline-scalar handling and the syntax-highlighting integration or grammar tests, then trace how the first line of a scalar is exposed to highlighting. Done means a shebang-selected language highlights the scalar contents without changing ordinary multiline strings, with coverage for the shell example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode, yaml
- Domain
- devtools, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100