Spaces / align of variable definitions in IntelliJ

本小妞迷上赌 提交于 2020-01-05 03:38:12

问题


I have this:

    $accountNr = $csvData[2][1];
$firstname = $csvData[3][1];
$lastname = $csvData[4][1];
$telephone1 = $csvData[5][1];
$telephone2 = $csvData[6][1];
$telephone3 = $csvData[7][1];
$telephone4 = $csvData[8][1];
$email1 = $csvData[9][1];
$email2 = $csvData[10][1];
$email3 = $csvData[11][1];
$email4 = $csvData[12][1];
$address1 = $csvData[13][1];
$address2 = $csvData[14][1];
$zip = $csvData[15][1];
$state = $csvData[16][1];

I want this:

$accountNr  = $csvData[2][1];
$firstname  = $csvData[3][1];
$lastname   = $csvData[4][1];
$telephone1 = $csvData[5][1];
$telephone2 = $csvData[6][1];
$telephone3 = $csvData[7][1];
$telephone4 = $csvData[8][1];
$email1     = $csvData[9][1];
$email2     = $csvData[10][1];
$email3     = $csvData[11][1];
$email4     = $csvData[12][1];
$address1   = $csvData[13][1];
$address2   = $csvData[14][1];
$zip        = $csvData[15][1];
$state      = $csvData[16][1];

There is a IntelliJ plugin called "String Manipulation" that does exactly that.

But: when I select the whole file and format it using the formatting of PhpStorm, everything gets changed again.

Is there a different cleaner way to do it?


回答1:


  1. Settings/Preferences
  2. Editor | Code Style | PHP
  3. Wrapping and Braces --> Assignment statement
  4. Activate Align consecutive assignments option



来源:https://stackoverflow.com/questions/39283900/spaces-align-of-variable-definitions-in-intellij

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!