Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow folding of entire YAML structures i.e. documents (---) #180848

Closed
Tracked by #1
redactedscribe opened this issue Apr 25, 2023 · 5 comments
Closed
Tracked by #1

Allow folding of entire YAML structures i.e. documents (---) #180848

redactedscribe opened this issue Apr 25, 2023 · 5 comments
Assignees

Comments

@redactedscribe
Copy link

redactedscribe commented Apr 25, 2023

When a file is set to use the YAML language, YAML can be folded. What I find to be missing however is the ability to fold from a document start (---) up to the next start or end (--- / ..., if present).

L1  ---
L2  key1: val
L3  key2: val
L4  ---
L5  keyA: val
L6  keyB: val
L7  ...

I don't have much experience of using pure YAML, but in the above scenario, I'd like to be able to fold lines 1 to 3.

L1  --- …
L4  ---
L5  keyA: val
L6  keyB: val
L7  ...

Hopefully pure YAML users would find this practical. I on the other hand would find this to be particularly useful within Markdown (see FR #180849).

Thanks.

VS Code 1.77.3

@aeschli
Copy link
Contributor

aeschli commented Apr 26, 2023

Please file the request against the YAML extension that you use.
By default, for YAML, VS Code creates folding ranges based on indentation

@aeschli aeschli closed this as completed Apr 26, 2023
@redactedscribe
Copy link
Author

I do not use a YAML extension. I suppose you're saying that VS Code wouldn't not like to extend folding beyond indentations and that an extension should implement folding on --- instead.

@aeschli
Copy link
Contributor

aeschli commented Apr 26, 2023

That's correct. Is --- coming from front matter? Then actually a front matter extension should add such folding ranges.

@redactedscribe
Copy link
Author

That's correct. Is --- coming from front matter? Then actually a front matter extension should add such folding ranges.

--- can exist in both YAML or Markdown front matter; I was hoping that one underlying feature could address both cases, but for me, folding the --- in Markdown is my wish. I will look into which Markdown extension I have that could possibly implement this.

@aeschli
Copy link
Contributor

aeschli commented Apr 26, 2023

Your files are FrontMatter files, from which markdown/yaml is generated. FrontMatter is a preproccessor.
The Markdown and Yaml language extensions should not have to know about FrontMatter syntax.
The folding ranges should come from a FrontMatter extension

@github-actions github-actions bot locked and limited conversation to collaborators Jun 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants