redhat-developer / redhat-developer/vscode-yaml

Support syntax highlight from different language for multi-line strings with a special comment

Open
#943 6 comments 32 reactions 0 assignees View on GitHub

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.

I have a bunch of YAML files that embeds XML, JSON, Bash Scripts, Dockerfiles, and so on. When opening them in VS Code, such inline strings are interpreted as plain strings, which makes it a little difficult to edit.

Describe the solution you would like

To support syntax highlight of other languages for multi-line strings block that has a special comment. For example:

javascript: | # yaml-language-server: $language=javascript
  console.log('hi')
json: | # yaml-language-server: $language=json
  {
    "hello": "world"
  }
Describe alternatives you have considered

Extract the file to its own window, make the changes and then copy it back to the YAML file. Having syntax highlight directly in the YAML file would be a huge time saver :).

Additional context

It looks like this can be implemented in vscode through something like this: https://github.com/Microsoft/vscode-extension-samples/tree/main/decorator-sample

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the VS Code decorator sample linked in the issue and how this extension handles YAML block scalars and special comments. The work is done when the requested language marker applies syntax highlighting to supported multiline strings in YAML files, including the JavaScript and JSON examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.