Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Perserve list format? #149

Closed
MrHinsh opened this issue Oct 24, 2024 · 4 comments
Closed

Perserve list format? #149

MrHinsh opened this issue Oct 24, 2024 · 4 comments

Comments

@MrHinsh
Copy link

MrHinsh commented Oct 24, 2024

Can we have some way to preserve the format of lists?

Original:

syllabus_ids: [1, 2, 3, 4]

After deserialise, serialised:

    syllabus_ids:
    - 1
    - 2
    - 3
    - 4

I'm happy with the default being the latter, but if the original was in the former, I like to maintain it.

p.s. Any chanse of enableing Discussion so I dont have to create a n issue for something that may not be an issue.

@gabriel-samfira
Copy link
Member

Hi @MrHinsh

Preserving it, not that much (we'd need to save state in some way), but I did just merge #148 which gives you an option to use flow style for lists. Would that do?

@MrHinsh
Copy link
Author

MrHinsh commented Oct 24, 2024

Flow is great except when the item is really long... It makes sense for short strings

@gabriel-samfira
Copy link
Member

gabriel-samfira commented Oct 24, 2024

Sadly there is no sane way to decide when to use flow and when to use block. And there is no simple way yo save the previous state of the yaml. Even if we do save the state, we would need to decide whether or not to invalidate it if an element is mutated before serializing back to yaml.

The only potential way I see for something like this is by using something like this:

And set a property on a field which indicates which style to use for that element and its children.

@gabriel-samfira
Copy link
Member

Discussions have been enabled.

@cloudbase cloudbase locked and limited conversation to collaborators Oct 25, 2024
@gabriel-samfira gabriel-samfira converted this issue into discussion #150 Oct 25, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants