Open jimblue opened 6 years ago
an other one, this:
format into this:
This is breaking...
Awesome plugin! 👍 Unfortunately it also messes things up for me.
<form class="form form-login" action="{{ path("fos_user_security_check") }}" method="post">
Becomes:
<form class="form form-login" action="{{ path(" fos_user_security_check") }}"="fos_user_security_check") }}"" method="post">
I have problem formatting switch loops.
Any update about a fix?
I tried to contact the PrettyDiff developer but they have not gotten back to me. The developer of Atom-Beautify also hopped onto the issue and was explaining the problems he is having too.
Here is the issue on PrettyDiff https://github.com/prettydiff/prettydiff/issues/502 and maybe we can all jump on and raise all of the issue we are having so maybe the developer will be responsive
Hi @mblode !
Seems that Prettydiff branch 3.0.0 solved a lot of issues tagged pretty diff
here. Did you try to use this version?
Oh sweet! I'll check it out tomorrow 👍 Thanks for being on top of this
@jimblue I went through the codebase and I don't think PrettyDiff 3.0.0 is ready for production yet. Do you have any idea of the timeline?
Hey @mblode, here is the answer to your question ✨✨✨
@mblode seem that prettydiff 3.0
development is pretty active! It should be release soon enough but it's already pretty solid :) !!
Didn't you had a chance to try vscode-twig-language
with prettydiff 3.0
?
After some testing with pretty diff 3.0, I believe that some spacing issues are fixed but there are still major problems that break the code and which is not okay. I'll try to get in contact with Pretty Diff to see if the developer can fix these issues.
Fixed example 1:
{% for module in page.collection() if module.advanced.nav.enabled %}
Fixed example 2:
{% for value in ['foo', 'bar', 'baz'] %}
Fixed example 3:
{{var}}
Broken example 1:
<form class="form form-login" action="{{ path("fos_user_security_check") }}" method="post">
Becomes...
<form class="form form-login" action="{{ path(" fos_user_security_check") }}"="fos_user_security_check") }}"" method="post">
Broken example 2:
<p class="hello">Copyright {{ Testing }}{{ Testing }}</p>
Becomes...
<p class="hello">Copyright
{{ Testing }}
{{ Testing }}
</p>
Broken example 3:
<input type="hidden" name="test" value="{{ id["index"] }}">
Becomes...
<input type="hidden" name="test" value="{{ id[" index"] }}"="index"] }}"">
Broken example 4:
{% switch variable %}
{% case "value1" %}
{% case "value2" %}
{% default %}
{% endswitch %}
{% some other statement %}
Becomes...
{% switch variable %}
{% case "value1" %}
{% case "value2" %}
{% default %}
{% endswitch %}
{% some other statement %}
Broken example 5:
<div>
Variable1: {{ variable1 }} / Variable2: {{ Variable2 }}
</div>
Becomes...
<div>
Variable1:
{{ variable1 }}
/ Variable2:
{{ Variable2 }}
</div>
Hey @mblode,
That's a very good idea to contact Pretty Diff while there still working on V3.0! It's the best time to let them know theses bugs 😄 !
Thank you so much for your help, I can't wait next version of vscode-twig-language
!
Hey guys, I have just pushed an update to Twig Language with a brand new formatter using Prettydiff 3 which brings about some major bug fixes. The update has fixed broken example 1 and 3 and I am currently discussing with the lead developer of Pretttydiff about broken example 2 and 4.
Here is his response:
I will think about how to approach example [4]. This isn't a defect, but rather a design decision. I am providing the same spatial relationships to the template tags as I do to text and self-closing tags. Whitespace in XML/HTML rendering is tokenized by default which means in the rendering of output all adjacent white space is collapsed into a single space character. My design decision is to indent where text/self-closing tags are separated by space which helps in identifying tags among long paragraphs of text without regard for word wrap.
Sorry about the slow development speeds and sub-par communication but hopefully these updates have fixed some of your other problems.
Nice to hear that! The update is not available yet, right? Thanks in advance.
@masiorama Prettydiff 3 is now being used on twig Language 1 and 2, which are both updated and available on the VS Code extension store. Please let me know if you are having any issues.
This https://pasteboard.co/HVjGrIu.jpg is what I see from VSCode, thanks.
It's definitely bad practice, but I've fully neglected the change-log. I'll make sure everything is up to date on the changelog as soon as I can.
Hi! In php cs fixer we have very helpful function "auto-format on save". Would You like to do the same in Your project?
this:
format into this:
Pretty hard to read!