-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Pass sigil/modifiers through to formatter #11348
Pass sigil/modifiers through to formatter #11348
Conversation
This allows the formatter plugins to format content based on whether it's a file or a sigil being formatted. The modifiers could be used for additional options.
Thank you! This is perfect feedback just in time for the release. I have dropped two tiny comments. Also, I have a question: should we pass those as arguments instead of options then? We can have a first argument being Also, finally, can you please update the docs to talk about those? We need to update one of |
One note, the opening delimiter of the sigil could also be passed in the tuple. I don't think it adds much here but since it's public facing it would be harder to add later on. Wdyt? |
@maartenvanvliet we can always add that as a separate option. Maybe it should be |
Yes, let's do that |
Alright, I will wait for that and once it is ready I will ship it. :) |
💚 💙 💜 💛 ❤️ |
This is amazing! ❤️ |
I created a formatter for graphql documents, see this PR absinthe-graphql/absinthe#1114 (comment) and @benwilson512 asked whether the formatting could be dependent on whether it's a sigil being formatted or a file.
As mentioned in the discussion it can be inferred by checking the extension of the file being formatted, but this seems brittle. Also it doesn't pass through which sigil is used or any of the applied sigil modifiers. This PR changes that by passing through
sigil: {name, modifiers}
to the opts of theformat(content, opts)
in a formatter plugin.