2014-07-25 33 views
3

我從* .blade.php文件複製下面的代碼:如何在PHPStorm中保留我的縮進刀片語法?

@section('content') 
    <h1>All Users</h1> 

    @if ($users->isEmpty()) 
     <h2>No Users Found</h2> 
    @else 
     @foreach ($users as $user) 
      <li>{{ link_to("https://stackoverflow.com/users/{$user->username}", $user->username) }}</li> 
     @endforeach 
    @endif 
@stop 

這是當它被粘貼到同一個文件時,它如何出現:

@section('content') 
    <h1>All Users</h1> 

@if ($users->isEmpty()) 
     <h2>No Users Found</h2> 
@else 
@foreach ($users as $user) 
      <li>{{ link_to("https://stackoverflow.com/users/{$user->username}", $user->username) }}</li> 
@endforeach 
@endif 
@stop 

我假設有一種代碼風格的地方是刪除刀片語法的縮進,但我找不到哪一個。我需要改變什麼設置?

回答

3

一般來說:

Settings (Preferences on Mac) | Editor | Smart Keys | Reformat on Paste

爲什麼「一般」 - 因爲在PhpStorm可沒有合適的刀片還支持(但即將推出),因此它沒有單獨的格式化規則。因爲上述選項很可能是導致這種行爲的原因之一。

+0

請參閱[支持刀片模板引擎](http://youtrack.jetbrains.com/issue/WI-14172)和http://youtrack.jetbrains.com/issues/WI?q=blade –