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

Support indentation w/ 2 spaces #101

Open
rofinn opened this issue Jun 4, 2018 · 6 comments
Open

Support indentation w/ 2 spaces #101

rofinn opened this issue Jun 4, 2018 · 6 comments

Comments

@rofinn
Copy link

rofinn commented Jun 4, 2018

It appears that yaml-rust only supports 4 spaces for indentation.

@iamed2
Copy link

iamed2 commented Jun 15, 2018

http://yaml.org/spec/1.2/spec.html#id2777534

The YAML 1.2 spec says that any number of spaces can be used to represent an indentation level.

@kbknapp
Copy link

kbknapp commented Jun 22, 2018

This has come up a few times in clap with an open issue being clap-rs/clap#965

@iamed2
Copy link

iamed2 commented Jun 22, 2018

clap was indeed how Rory discovered this

@hoodie
Copy link
Contributor

hoodie commented Jun 22, 2018

I don't think this is true, as I commented on clap-rs/clap#965 already. I also have some tests that should demonstrate this. Or do I not understand correctly?

@kbknapp
Copy link

kbknapp commented Jun 22, 2018

@hoodie I agree the specific test referenced in clap#965 doesn't quite line up with this issue, however just today I ran into an issue where the only change made was indents from 4 to 2 and it works with 4 but fails with 2.

Once I get to a computer I can post the actual test for reference.

@berwyn
Copy link

berwyn commented Nov 12, 2018

Just ran into this today via Clap. Having a background with Rails and Jekyll, I wrote my Clap yaml with two spaces for indentation and then was beat over the head with weird issues where the yaml would fail to parse. Took some digging and found out that indentation by two spaces is what killed me. Given that every other yaml parser I've used hasn't cared about the number of spaces present, but rather the number of spaces relative to the parent, I'd love to see this functionality added!

Especially of note here, most editors default to two spaces for indentation in yaml, since that's become the de-facto standard for yaml writers/consumers, which could really exacerbate the issue in Rust projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants