Search code examples
macoslaravelphpstormlaravel-blade

PhpStorm highlighting Laravel blade incorrectly on Mac? Was ok on old PC


tl;dr - My PhpStorm 10 is highlighting my blade code incorrectly: (see screenshot)

Screenshot sample of incorrect highlighting: enter image description here

Please help me fix this?

I recently switched away from PC (PhpStorm 9) to Mac (PhpStorm 10.0.2).

I git cloned to the new mac (a Laravel 5.1 project), setup homestead, ok.

But PhpStorm highlights this code as if I've missed an ending semicolon. (see screenshot above - the below is the code that gets highlighted strangely).

        @yield('content')

           <!--also the following-->

        @if (Session::has('flash_message'))
            <div>{{ Session::get('flash_message') }}</div>
        @endif

This was not an issue on my old PC setup. AFAIK Laravel's @yield and @if @endif don't need a semicolon, based on this.

I've run this code for 4 months from my old PC without issues, and it runs normally on my Mac's Laravel Homestead installation.

I've tried these:

1. exported and imported all settings from my old PC's phpstorm to the Mac - it imported my text colors but still highlights wrong on Mac.

2. downloaded the Laravel plugin and restarted phpstorm - no change

3. confirmed the blade plugin is activated in phpstorm

4. tested the same file on my old PC - no issues there in phpstorm 9.

What could be causing this highlighting? What have I missed?


Solution

  • Tinkered around and a solution:

    Go to Phpstorm

    Preferences (on Mac, 'Settings' on PC) > Editor > Colors & Fonts > PHP > PHP Code > Background

    On my Mac the background color was set incorrectly to white (inherited).

    I then unchecked "Use Inherited Attributes" and set it to black. Problem fixed.

    I don't know why this was set to white as on my PC it is set to black. I had done a phpstorm full settings export from pc, and imported to mac, using the generated settings.jar file so I can't say why this did not import properly. Don't know if something changed between versions 9.0 and 10.0 or whether it got skipped somehow during import.