-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 Handlebars #5340
Comments
Am I correct in assuming, that work has already started in |
@buschtoens yes |
For anyone who might be watching this, you can already try this out like so: yarn prettier '**/*.hbs' --parser glimmer Stolen from @ikatyang's comment here: #3534 (comment). |
Please note that the glimmer printer is currently unrelated to the HTML printer, which means their formatting rules are not the same. To support Handlebars, we need to somehow combine them together, see #5511 (comment) for more info. |
Ah thanks for the clarification @ikatyang! Is my previous comment misleading then? I'm happy to edit it if that's the case. |
I've tried this on our codebase (with |
@mydea That does not sound intended. Please share an example on the playground. |
Hmm, I can't select the But what it does is format this: {{test}}
{{other-test}}
{{final-test}}
to {{test}}
{{other-test}}
{{final-test}} |
Ah, sorry, I didn't know glimmer wasn't available there. |
I think adding Glimmer support to the playground should be done anyways so that we can at least experiment with it there. I would really love to make this official. |
When processing conditionals the parser / formatter takes liberties with multi level nesting. On occasion it combines the conditions in ways that end up with broken logic. |
@mfeckie yep, it is bug, better create new issue, also feel free to send a PR with fix (it is easy) |
@evilebottnawi If I knew how .. I would love to fix it. Happy to open new issue too |
Another one - removes whitespace between helpers and text in ways that alter the rendered output Playground here |
Playground link to illustrate: https://prettier.io/playground/#N4Igxg9gdgLgprEAuEAeAznMMCW0AEYANgIbroC8AOiACokBG6wwAxDgGb4cCuRRAXwH56TALRje-FgHpOQmgD4qUfGvwsAfq0UABAA4kATrhJExDIhDABrIbIPHT5y9ZuaFUVDMzY8UZSgQABoQCH1caHRkUGMjCAB3AAVjBGiUEgA3CBwAExCQBiMSWzgYAGVDMBwoAHNkGCMeOFCACxgAWyIAdVaceHQquHK0-pxM-oBPZHByAprMEyTi2o6SZA4zTFCAK3QADwAhYtKKkg64ABkauA2tlpA9-fKa2qI4AEUeCHg7om2QIYjIsZm8cB0LkYCvojDUYN08jBWsgABwABlCMIgmG6xX0MxhcEWmVuoSMcAAjjwcOTliRVuskJt-g9MB0cA0mqzXu8vj9bkz7qEYIwEbkkcgAEzC4o4IivADCEAhjJAUGgpJAPEwonSzMwQiAA |
@pmccloghrylaing I'm not sure that is valid Handlebars. At least not anything that I have ever seen. |
@Alonski Handlebars doesn't complain about it - @partial-block is really useful if you're creating components and Glimmer doesn't seem to support Here's another example of valid Handlebars that I wouldn't expect Glimmer to support:
|
@pmccloghrylaing ok now I understand you. Maybe this should be called language glimmer then. Or something else. They aren't 100% compatible |
Is there any plan for handlebars support? it seems like Glimmer is on a path to be supported but, as was pointed out, Glimmer !== Handlebars. |
@macgyver we have plugin api, so you can start this as plugin right now |
I realized today, this is stripping the tilde character: Prettier 1.19.1 --parser glimmer Input: <li data-test-reason>
{{#if some.thing}}
for {{~some.item~}}
{{else}}
<span class="empty">
----
</span>
{{/if}}
</li> Output: <li data-test-reason>
{{#if some.thing}}
for{{some.item}}
{{else}}
<span class="empty">
----
</span>
{{/if}}
</li> Original Report: mfeckie/handlebars-formatter#18 |
I am opening this issue to track Handlebars support. It was previously tracked in #1882 but that was closed when we added HTML support, so this issue is for Handlebars only.
The text was updated successfully, but these errors were encountered: