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

Add Custom Region Support to Yaml Files

Open reskin89 opened this issue 1 year ago • 7 comments

Is your enhancement related to a problem? Please describe.

At times there are areas of a yaml file (like a block of anchor definitions) that take up a large portion of the file, and while they may not be under a top level key, a user would like to fold them so as to more easily read and navigate the yaml file.

Describe the solution you would like

Currently, with JS in vscode, you can add a comment such as // #region and // #endregion to support this. Currently yaml in vscode does not support this type of functionality, and that comment key is not valid in yaml.

Something like # !region or the like so we could have this functionality in a yaml file would be really nice

Describe alternatives you have considered

There aren't really any alternatives to this, as some things you'd like a custom region for are top down, and as such, you can't put at say, the bottom of the file.

reskin89 avatar Jul 20 '23 14:07 reskin89

Although YAML isn't mentioned in the VS Code documentation, this behavior seems to be baked into the editor by default, including the keybindings. This works if this extension is disabled, so unfortunately it seems like this extension is preventing this from working.

MindfulMinun avatar Aug 19 '23 00:08 MindfulMinun

i wholly support this request, because I now split my yaml files for readability.

ekelmans avatar Oct 24 '23 11:10 ekelmans

Usually for languages where # starts a comment, the syntax used by vscode is #region [...] and #endregion. No need for extra characters like in # !region.

fholzer avatar Dec 04 '23 18:12 fholzer

That doesn’t work with yml files @fholzer . I attempted that as well

reskin89 avatar Dec 04 '23 18:12 reskin89

Right. Neither does it for me. I was just suggesting to use that specific syntax, if it was added to this extension.

fholzer avatar Dec 05 '23 08:12 fholzer