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

Ability to have end stream token #194

Open
alexandrebrg opened this issue Jul 16, 2024 · 2 comments
Open

Ability to have end stream token #194

alexandrebrg opened this issue Jul 16, 2024 · 2 comments

Comments

@alexandrebrg
Copy link

Hello 👋

yamlfmt allows to have the start token ---, but doesn't yet allow for end token .... That would be very useful for projects where this is needed, as for now yamlfmt will just remove the end token, making projects linters fail.

Implementation would be similiar to include_document_start.

@alexandrebrg
Copy link
Author

I'd be happy to help if needed :)

@braydonk
Copy link
Collaborator

Hi @alexandrebrg thanks for the feature request! I think it makes sense.

I think the only way to do this where yamlfmt actually handles multi-document files properly is to modify the yaml library. It shouldn't be too difficult, I forget if in the Node data structure there is an end to the document, but I am reasonably certain that it should work by adding something to the function that triggers on a yaml_DOCUMENT_END_EVENT here:
https://github.com/braydonk/yaml/blob/10bcc859418b821726f51e2beb7406449cf0b4a2/emitterc.go#L499-L527
If you are willing to give it a shot I would certainly encourage it! My time is even more limited to work on this project recently. I'll be happy to review any PRs to braydonk/yaml and can tag a new release whenever it gets merged so it can be used in yamlfmt.

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

2 participants