Skip to content

Comment causes issue with ScalarStyle.FOLDED #1935

@jonasfj

Description

@jonasfj

Example

import 'package:yaml/yaml.dart';
import 'package:yaml_edit/yaml_edit.dart';

void main() {
  final doc = YamlEditor('''
- 0
- 1 # comment
- 2
''');

  final node = wrapAsYamlNode(
    'hello',
    scalarStyle: ScalarStyle.FOLDED,
  );
  doc.update([1], node);

  print(doc);
}

We should have a test case covering this. And ideally more test cases covering similar cases.

And we should fix this bug. Maybe we need to move the comment to the next line.
Or maybe we need to drop the comment in cases like this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueA good starting issue for contributors (issues with this label will appear in /contribute)package:yaml_edittype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions