php code not indenting in adobe brackets
Asked Answered
T

2

9

I am using Adobe Brackets 1.0 code editor.

I have .php pages that include HTML & PHP lines.

HTML lines indenting fine BUT PHP lines do not indent correctly!

is there any extension or way to force PHP lines to indent correctly?

I've used and tried the following extensions but non of them did the job:

  1. [PHP-SIG] PHP SmartHints
  2. PHP Syntax Hint
  3. QuickDocsPHP
  4. QuickDocsRegEx
  5. Tab tags
  6. WordHint

Thanks

P.S. I can't believe such good editor lack this important feature & functionality out-of-the-box.


UPDATE after Nicolò's answer:

  1. Before using "Indentator" extension (Manual indentation)

enter image description here

  1. After installing "Indentator" extension and applying Ctrl + Alt + i

enter image description here

Telekinesis answered 18/11, 2014 at 10:23 Comment(2)
why the down-voting?!!! what is wrong with the question? every one is free to down vote any question if he/she think it is off-topic or badly submitted or for any other reason BUT be helpful and brave by explaining why you down vote it so we can avoid the mistakes in the future!!!!!!!Telekinesis
Don't get mad, there are people up voting as well. I up voted too, because I have the same question about indenting PHP in brackets. By the way, I think the Indentator's result is reasonable because the PHP code has its own scope and it should be different from HTML in terms of large chunk of PHP code.Westmoreland
T
1

I found a workaround to indent php codes

all what I had to do is to wrap the php code inside {}

Example

<body>
  <div>
    <div>
      <!-- some html contents -->
      <?php
      {
        //your php code here;
        //next lines will be indented correctly;
      }
      ?>
      <div>
        <div>
          <?php
          {
            //php code here;
            //another php line;
          }
          ?>
        </div>
      </div>
    </div>
  </div>
</body>

I found this way works fine with me and not causing any issues to the codes or to the pages.

Hope this helps

Telekinesis answered 14/8, 2015 at 18:15 Comment(0)
K
3

Try to install the "Indentator" extension and press Ctrl+Alt+i

UPDATE After SULTAN's update:

There is an issue on GitHub about this problem: https://github.com/adobe/brackets/issues/10038

Katharinekatharsis answered 23/11, 2014 at 8:3 Comment(1)
Sorry, didn't work. I'll update the question with two images showing the results.Telekinesis
T
1

I found a workaround to indent php codes

all what I had to do is to wrap the php code inside {}

Example

<body>
  <div>
    <div>
      <!-- some html contents -->
      <?php
      {
        //your php code here;
        //next lines will be indented correctly;
      }
      ?>
      <div>
        <div>
          <?php
          {
            //php code here;
            //another php line;
          }
          ?>
        </div>
      </div>
    </div>
  </div>
</body>

I found this way works fine with me and not causing any issues to the codes or to the pages.

Hope this helps

Telekinesis answered 14/8, 2015 at 18:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.