Disable auto indentation for embedded PHP code

219 Views Asked by At

In my settings I have 4 spaces to indent PHP code and 2 for HTML code My templates have .php extension

When I trying to indent a PHP code with 2 spaces it forces 4 spaces. "Backspace" key does not work at all

<?php foreach($array as $k => $v) { ?>
  <a class="btn btn-default" href="<?php echo $this->url("path"); ?>">
      <?php echo $this->text('Text'); ?> <---MOVE this 2 spaces left
  </a>
<?php } ?>

How to allow custom indentation for such cases?

1

There are 1 best solutions below

1
Dmitrii On BEST ANSWER

That's a known issue: https://youtrack.jetbrains.com/issue/WI-32401. Here's a code piece that illustrates this a little bit better:

<?php foreach ($array as $k => $v) { ?>
  <a class="btn btn-default" href="<?php echo $this->url("path"); ?>">
      <?php echo $this->text('Text'); ?> <---MOVE this 2 spaces left
    <div>
      <div>
          <?php echo $this->text('Text'); ?>
          <?php
          echo $this->text('Text');
          if ($a > 1) {
              echo 1;
          }
          ?>
      </div>
    </div>
  </a>
<?php } ?>

Feel free to vote for/comment it to follow the updates of the issue