theredled
theredled

Reputation: 1040

Bug with HTML/PHP syntax highlighting

I'm using PHPStorm 6.0.3. Max for 6.x.

There's a random bug with syntax highlighting when PHP is inside HTML:

enter image description here

On some lines it works, on some it doesn't...

Text code for Copy/Paste:

        <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
        <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135"
             alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
    </a>
<?php if ($is_packs) { ?>
    <div class="pictos">
        <?php
          if ($_product->getAttributeText('heure_conso'))
            echo '<div class="heure-conso">'.$_product->getAttributeText('heure_conso').'</div>';
          if ($_product->getAttributeText('pack_spec'))
            echo '<div class="pack_spec">'.$_product->getAttributeText('pack_spec').'</div>';
          echo '<div class="nb-plats">'.$_product->getAttributeText('pack_spec').'</div>';
          if (Mage::helper('tbm/data')->productIsOkForCustomerPhase($_product))
            echo '<div class="phase-ok">'.$this->__('Adapté à votre phase').'</div>';
        ?>
    </div>
    <div class="description">
        <?php echo $_product->getShortDescription() ?>
    </div>
<?php } ?>

Any idea ?

Upvotes: 1

Views: 500

Answers (1)

LazyOne
LazyOne

Reputation: 165088

Not a bug -- it's your custom settings.

For whatever reason / somehow (does not actually matter) you have injected custom language (most likely HTML) into all DIV tags (the light green background). Now everything in such tags is forcibly treated as that language (HTML?) -- PHP is ignored completely.

Settings (Preferences on Mac) | Language Injections -- find and delete offending rule. It should have "project" or "global" in most right column (Scope) -- do not touch "bundled" ones.

Alternatively -- Alt + Enter while having caret inside problematic place and choose "Uninject xxx" from popup menu.

Upvotes: 4

Related Questions