Folding issues with lang-yaml and/or lezer/yaml BlockMapping

Folding seems incorrect for BlockMapping nodes: only the first entry is foldable.

Screenshot 2024-04-11 at 9.58.32 AM

playground

For reference, here is a monaco example that has what I think is correct behavior.

Notes

Altering the fold to replace BlockMapping with Pair seems to result in the desired behavior.

Screenshot 2024-04-11 at 10.01.17 AM
playground

E.g.

// src/yaml.ts#L40

// before
foldNodeProp.add({
  'BlockSequence BlockMapping BlockLiteral': (node, state) => {

// after
foldNodeProp.add({
  'BlockSequence Pair BlockLiteral': (node, state) => {

Obviously, that’s more of hack around this though. This may be an issue with blockEnd here not terminating BlockMapping appropriately which throws off the folding logic in lang-yaml but i’m not certain.

This patch makes the suggested change.