This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 191557

Summary: Smarty code formatting
Product: php Reporter: MrDutchy
Component: SmartyAssignee: Martin Fousek <marfous>
Status: VERIFIED FIXED    
Severity: normal CC: mfukala, mmirilovic
Priority: P2    
Version: 7.0   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

Description MrDutchy 2010-11-02 11:25:01 UTC
Code formatting breaks if a {foreach}{/foreach} is involved (maybe more, possibly all block tags). Closing tag is indented one further then its opening tag. The bug affects all html tag indents for the remainder of the file.

<!-- Expected result: !-->
<table>
   {foreach from=$source item=item}
   <tr>
      <td>
         {$item.var}
      </td>
   </tr>
   {/foreach}
</table>

<h1>HTML after</h1>
<p>
  A paragraph
</p>

<!-- Actual result: !-->
<table>
   {foreach from=$source item=item}
   <tr>
      <td>
         {$item.var}
      </td>
   </tr>
     {/foreach}
  </table>

  <h1>HTML after</h1>
  <p>
    A paragraph
  </p>
Comment 1 Martin Fousek 2010-11-26 15:42:10 UTC
Hi MrDutchy, troubles with code formating in Smarty are good known. It's because there wasn't still implemented CodeFormater at all for now. At least I can hide the "Format" button until will be code formating implemented.
Comment 2 Martin Fousek 2010-11-26 17:00:25 UTC
Ok, I removed Format action from the context menu at least for now, you can see it in next dev build: http://hg.netbeans.org/main/contrib/rev/11bd2356ad7b
Comment 3 Martin Fousek 2011-03-27 14:18:19 UTC
Ok, I finally implemented at least some basic indentation support, so your code will be formated properly now...

http://hg.netbeans.org/main/contrib/rev/07429a4ce259
BTW, works since version 1.50 - in dev build for now.


See...
<table>
    {foreach from=$source item=item}
        <tr>
            <td>
                {$item.var}
            </td>
        </tr>
    {/foreach}
</table>

<h1>HTML after</h1>
<p>
    A paragraph
</p>

<!-- Actual result: !-->
<table>
    {foreach from=$source item=item}
        <tr>
            <td>
                {$item.var}
            </td>
        </tr>
    {/foreach}
</table>

<h1>HTML after</h1>
<p>
    A paragraph
</p>
Comment 4 Martin Fousek 2011-03-28 07:53:15 UTC
php.smarty added as a friend of css.editor: http://hg.netbeans.org/web-main/rev/e68e5bfc48af

For proper functionality in NB 7.0 would be needed to transplant this patch into release70 branch.
Comment 5 Marek Fukala 2011-03-28 08:09:14 UTC
reviewed, feel free to integrate
Comment 6 Martin Fousek 2011-03-29 08:11:13 UTC
Integrated into release70:
http://hg.netbeans.org/releases/rev/c27d0c6270a1
Comment 7 Quality Engineering 2011-03-29 08:44:01 UTC
Integrated into 'main-golden', will be available in build *201103290400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/e68e5bfc48af
User: Martin Fousek <marfous@netbeans.org>
Log: added php.smarty as a friend of css.editor - #191557, #188124
Comment 8 Vladimir Riha 2011-04-05 14:30:16 UTC
v.