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

whitespace newline whitespace in folded string causes errors in ScalarStyle.FOLDED #41

Closed
jonasfj opened this issue Mar 2, 2023 · 1 comment · Fixed by #87
Closed
Labels
good first issue A good starting issue for contributors (issues with this label will appear in /contribute) type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@jonasfj
Copy link
Member

jonasfj commented Mar 2, 2023

Example

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

void main() {
  final doc = YamlEditor('''
"hello"
''');

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

  print(doc);
}

We need to:

  • fix this error,
  • write a test cases to ensure it doesn't happen again.

Maybe, there are some cases where we have to output as "hello \n world" in double quoted mode. If we can't find a reasonably safe way to output in folded style, then it's safer to fallback to double quoted mode.

But ideally, we won't have to fallback in all non-trivial cases.

@jonasfj jonasfj added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) good first issue A good starting issue for contributors (issues with this label will appear in /contribute) labels Mar 2, 2023
@gantanikhilraj
Copy link

Hello @jonasfj, I would like to work on this, could you please brief the issue? and also assign it to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue A good starting issue for contributors (issues with this label will appear in /contribute) type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
2 participants