vscode-yaml icon indicating copy to clipboard operation
vscode-yaml copied to clipboard

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

Open felipecrs opened this issue 2 years ago • 6 comments

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

felipecrs avatar Jun 19 '23 20:06 felipecrs

Would be great to have this.

surgiie avatar Jan 18 '24 22:01 surgiie

Yes, yes, yes! My use case ould probably go vastly towards .gitlab-ci.yml files which often contain bash scripts. Even if it was configurable only via .vscode/settings.json, I'd take it just to speed up pipeline development.

rgembalik avatar May 02 '24 11:05 rgembalik

@felipecrs Any updates?

bdsoha avatar Jun 16 '24 06:06 bdsoha

@bdsoha, from my side no. :)

felipecrs avatar Jun 16 '24 13:06 felipecrs

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

voxpelli avatar Aug 02 '24 12:08 voxpelli