You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/10/27 10:03:45 UTC

[GitHub] [netbeans] sarelvdm opened a new issue, #4869: Twig Indenting code format, not indenting correctly

sarelvdm opened a new issue, #4869:
URL: https://github.com/apache/netbeans/issues/4869

   ### Apache NetBeans version
   
   Apache NetBeans 15
   
   ### What happened
   
   Im using Twig, the (IF statement does not align,
   
   ![pic1](https://user-images.githubusercontent.com/3070441/198254476-09bef49a-4815-41f1-ac2e-67ee63caf48a.gif)
   ![pic2](https://user-images.githubusercontent.com/3070441/198254501-813a5845-6051-423e-a002-76acc50b3fe5.gif)
   
   
   ### How to reproduce
   
   Detail same as in what happened
   
   ### Did this work correctly in an earlier version?
   
   Apache NetBeans 12.6 or earlier
   
   ### Operating System
   
   Windows 10 X64
   
   ### JDK
   
   19
   
   ### Apache NetBeans packaging
   
   Apache NetBeans provided installer
   
   ### Anything else
   
   Every time you use Twig file and try to do source format.
   
   ### Are you willing to submit a pull request?
   
   Yes
   
   ### Code of Conduct
   
   Yes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] sarelvdm commented on issue #4869: Twig Indenting code format, not indenting correctly

Posted by GitBox <gi...@apache.org>.
sarelvdm commented on issue #4869:
URL: https://github.com/apache/netbeans/issues/4869#issuecomment-1312554795

   Hi  @junichi11,   I found addition BUG **missing closing brackets under twig** when creating new <script's
   
   1. I found this bug <script type='text/javascript'> it doesn't create the closing tag </script>
   2.  inside the <script type='text/javascript'> when using if on the else it does not create the closing } see sample code with comments
   
   ```
   <script type='text/javascript'>
                               $(document).ready(function () {
   
                                   $("#live_search").keyup(function () {
   
                                       var input = $(this).val();
                                       //alert(input);
   
                                       if (input != "") {
   
                                           $.ajax({
                                               url: '/fetchdata',
                                               type: 'POST',
                                               dataType: 'json',
                                               data: {_token: $('meta[name="csrf-token"]').attr('content'), '{{ csrf.key }}': '{{ csrf.token }}',
                                                   input: input
                                               },
                                               success: function (data) {
                                                   $("#searchresults").html(data);
                                               }
                                           });
                                       }else {  // if you type in the { it should also create the closing tag,
                                               
                                              } // <<<< this one  } dont get created 
          
   
                                   });
                               });
     </script> //<<<< this closing tag don't get created, need to type manually 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] sarelvdm commented on issue #4869: Twig Indenting code format, not indenting correctly

Posted by "sarelvdm (via GitHub)" <gi...@apache.org>.
sarelvdm commented on issue #4869:
URL: https://github.com/apache/netbeans/issues/4869#issuecomment-1529390792

   thank you for trying


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on issue #4869: Twig Indenting code format, not indenting correctly

Posted by GitBox <gi...@apache.org>.
junichi11 commented on issue #4869:
URL: https://github.com/apache/netbeans/issues/4869#issuecomment-1302825550

   Just wait. Please write a simple example code if possible. An expected result and an actual result, too.
   NOTE: I can't promise anything. (I can't work on it soon now.)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] sarelvdm commented on issue #4869: Twig Indenting code format, not indenting correctly

Posted by GitBox <gi...@apache.org>.
sarelvdm commented on issue #4869:
URL: https://github.com/apache/netbeans/issues/4869#issuecomment-1357154764

   @junichi11 
   Please, will be greatly appreciated.   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on issue #4869: Twig Indenting code format, not indenting correctly

Posted by GitBox <gi...@apache.org>.
junichi11 commented on issue #4869:
URL: https://github.com/apache/netbeans/issues/4869#issuecomment-1293367955

   Please write an example code to reproduce it. Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] sarelvdm commented on issue #4869: Twig Indenting code format, not indenting correctly

Posted by GitBox <gi...@apache.org>.
sarelvdm commented on issue #4869:
URL: https://github.com/apache/netbeans/issues/4869#issuecomment-1324678724

   @junichi11
    
   
   > Just wait. Please write a simple example code if possible. An expected result and an actual result, too. NOTE: I can't promise anything. (I can't work on it soon now.)
   
   If possible, I know you under pressure. Others will also benefit from it. 
   You helped with the previous twig plugin, thanks... using it daily. 
   
   Thanks for your time to make NetBeans the best.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] sarelvdm commented on issue #4869: Twig Indenting code format, not indenting correctly

Posted by GitBox <gi...@apache.org>.
sarelvdm commented on issue #4869:
URL: https://github.com/apache/netbeans/issues/4869#issuecomment-1295034521

   @junichi11 I hope the above code and layout is to you standard
   
   Prepared to help with the testing.
   Thank you.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] sarelvdm commented on issue #4869: Twig Indenting code format, not indenting correctly

Posted by GitBox <gi...@apache.org>.
sarelvdm commented on issue #4869:
URL: https://github.com/apache/netbeans/issues/4869#issuecomment-1303059705

   ### Correct
   
   {% block content %}
   {#Im selecting between 2 routes, reason for the 2 forms, this is based on variable input}
   {#The if else endif should be aligned  #}
       
   {#The twig logic alignment should take preferance above HTML except when Twig conditions "If / For" loop is used inside a html div#}
   
   
       <div class="container">
           <div class="row">
               <div class="box col-8">
                   <div class="card">
                       <div class="card-body">
                           {% if nextmemberid == ''%}
                               <form action="{{ route('accmember',{_memberid:currentmember.memberid}) }}" method="POST">
                                   <input type="hidden" name="memberid" value="{{ currentmember.memberid }}">
                           {% else %}
                               <form action="{{ route('accmember',{_memberid:nextmemberid}) }}" method="POST">
                                   <input type="hidden" name="memberid" value="{{ nextmemberid }}">
                           {% endif %}
                                   <input type="hidden" name="{{ csrf.key }}" value="{{ csrf.token }}">
   
                                   <div class="row">
                                       <div class="col-md-6 mb-3">
                                           <div class="form-floating form-floating-group flex-grow-1">
                                               <input class="form-control{{ errors.firstname ? ' is-invalid' : '' }}" 
                                                      id="firstname" name="firstname" placeholder="firstname" 
                                               {% if currentmember.firstname|trim is not empty %}
                                                   value="{{ currentmember.firstname }}">
                                               {% else %}  
                                                   value="{{old.firstname }}"> 
                                               {% endif %} 
                                               <label for="uafirstname">First name</label> 
                                               {% if errors.firstname %}
                                                   <div class="invalid-feedback">
                                                       <label for="floatingInputInvalid">{{ errors.firstname | first }}</label>
                                                   </div>
                                               {% endif %}
                                           </div>
                                       </div>
                                   </div>
                               </form>
                       </div>
                   </div>
               </div>
           </div>
       </div>
   {% endblock %}
   
   ### Wrong indentation 
   
   
   
   {% block content %}
   
       <div class="container">
           <div class="row">
               <div class="box col-8">
                   <div class="card">
                       <div class="card-body">
                           {% if nextmemberid == ''%}
                               <form action="{{ route('accmember',{_memberid:currentmember.memberid}) }}" method="POST">
                                   <input type="hidden" name="memberid" value="{{ currentmember.memberid }}">
                               {% else %}
                                   <form action="{{ route('accmember',{_memberid:nextmemberid}) }}" method="POST">
                                       <input type="hidden" name="memberid" value="{{ nextmemberid }}">
                                   {% endif %}
                                   <input type="hidden" name="{{ csrf.key }}" value="{{ csrf.token }}">
   
                                   <div class="row">
                                       <div class="col-md-6 mb-3">
                                           <div class="form-floating form-floating-group flex-grow-1">
                                               <input class="form-control{{ errors.firstname ? ' is-invalid' : '' }}" 
                                                      id="firstname" name="firstname" placeholder="firstname" 
                                                      {% if currentmember.firstname|trim is not empty %}
                                                          value="{{ currentmember.firstname }}">
                                               {% else %}  
                                                   value="{{old.firstname }}"> 
                                               {% endif %} 
                                               <label for="uafirstname">First name</label> 
                                               {% if errors.firstname %}
                                                   <div class="invalid-feedback">
                                                       <label for="floatingInputInvalid">{{ errors.firstname | first }}</label>
                                                   </div>
                                               {% endif %}
                                           </div>
                                       </div>
                                   </div>
                               </form>
                       </div>
                   </div>
               </div>
           </div>
       </div>
   {% endblock %}


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on issue #4869: Twig Indenting code format, not indenting correctly

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on issue #4869:
URL: https://github.com/apache/netbeans/issues/4869#issuecomment-1465083975

   Unfortunately, we can't fix this case from the twig module.
   ```twig
   <div class="container">
       {% if nextmemberid == ''%}
           <form action="{{ route('accmember',{_memberid:currentmember.memberid}) }}" method="POST">
               <input type="hidden" name="memberid" value="{{ currentmember.memberid }}">
       {% else %}
           <form action="{{ route('accmember',{_memberid:nextmemberid}) }}" method="POST">
               <input type="hidden" name="memberid" value="{{ nextmemberid }}">
       {% endif %}
           </form>
   </div>
   ``` 
   
   If you close the HTML tag, maybe it works correctly. 
   e.g.
   ```twig
   <div class="container">
       {% if nextmemberid == ''%}
           <form action="{{ route('accmember',{_memberid:currentmember.memberid}) }}" method="POST">
               <input type="hidden" name="memberid" value="{{ currentmember.memberid }}">
           </form>
       {% else %}
           <form action="{{ route('accmember',{_memberid:nextmemberid}) }}" method="POST">
               <input type="hidden" name="memberid" value="{{ nextmemberid }}">
           </form>
       {% endif %}
   </div>
   ``` 
   As a workaround:
   Please use variables. **NOTE** I'm not an expert of twig.
   ```twig
   {% if nextmemberid == ''%}
       {% set example = 'foo' %}
       {% set value = 'a' %}
   {% else %}
       {% set example = 'bar' %}
       {% set value = 'b' %}
   {% endif %}
   
   <form action="{{ example }}" method="POST">
       <input type="hidden" name="memberid" value="{{ value }}">
   </form>
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] sarelvdm commented on issue #4869: Twig Indenting code format, not indenting correctly

Posted by "sarelvdm (via GitHub)" <gi...@apache.org>.
sarelvdm commented on issue #4869:
URL: https://github.com/apache/netbeans/issues/4869#issuecomment-1461988957

   @junichi11 any news regarding the code formatting in Twig 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] sarelvdm commented on issue #4869: Twig Indenting code format, not indenting correctly

Posted by GitBox <gi...@apache.org>.
sarelvdm commented on issue #4869:
URL: https://github.com/apache/netbeans/issues/4869#issuecomment-1293702752

   
   Hi, thanks for responding.
   
   The Twig conditions **"IF statement or the For loop"** should take preference in alignment over HTML Code.
   You can align HTML code inside the Twig condition 
   
   Example 
   "if" 
   -- "Html code" 
   "else" 
   -- "Html code" 
   "endif"
   
   The For loop should work similar
   
   
   {% block content %}
       <div class="container">
           <div class="row">
               <div class="box col-8">
                   <div class="card">
                       <div class="card-body">
   
                           {#Im selecting between 2 routes, based on variable input.#}
                           {#The if else endif should be alligned marked with ** #}
                           {% if nextmemberid == ''%} {#**#}
                               <form action="{{ route('accmember',{_memberid:currentmember.memberid}) }}" method="POST">
                                   <input type="hidden" name="memberid" value="{{ currentmember.memberid }}">
                               {% else %} {#**#}
                                   <form action="{{ route('accmember',{_memberid:nextmemberid}) }}" method="POST">
                                       <input type="hidden" name="memberid" value="{{ nextmemberid }}">
                                   {% endif %} {#**#}
                                   <input type="hidden" name="{{ csrf.key }}" value="{{ csrf.token }}">
   
                                   <div class="row">
   
                                       <div class="col-md-6 mb-3">
                                           <div class="form-floating form-floating-group flex-grow-1">
                                               <input class="form-control{{ errors.firstname ? ' is-invalid' : '' }}" 
                                                      id="firstname" name="firstname" placeholder="firstname" 
                                                      {% if currentmember.firstname|trim is not empty %} {# The if should be alligned with AAA #}
                                                          value="{{ currentmember.firstname }}">
                                               {% else %}  {# AAA #}
                                                   value="{{old.firstname }}"> 
                                               {% endif %}  {# AAA #}
                                               <label for="uafirstname">First name</label> 
                                               {% if errors.firstname %}
                                                   <div class="invalid-feedback">
                                                       <label for="floatingInputInvalid">{{ errors.firstname | first }}</label>
                                                   </div>
                                               {% endif %}
                                           </div>
                                       </div> 
   
                                   </div>
                                   <button type="submit" class="btn btn-outline-primary btn-sm">Update</button>
   
                               </form>
                       </div>
                   </div>
               </div>
           </div>
       </div>
   {% endblock %}
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] sarelvdm commented on issue #4869: Twig Indenting code format, not indenting correctly

Posted by GitBox <gi...@apache.org>.
sarelvdm commented on issue #4869:
URL: https://github.com/apache/netbeans/issues/4869#issuecomment-1302254780

   @junichi11 im really sorry to bug you... can you please take a look at this. I belief you very busy 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists