本文介绍了IntelliJ中变量定义的空格/对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个:

    $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];

我想要这个:

$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];

有一个名为"String Manipulation"的IntelliJ插件可以做到这一点.

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

但是:当我选择整个文件并使用PhpStorm的格式对其进行格式化时,一切都会再次更改.

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. Settings/Preferences
  2. Editor | Code Style | PHP
  3. Wrapping and Braces --> Assignment statement
  4. 激活Align consecutive assignments选项
  1. Settings/Preferences
  2. Editor | Code Style | PHP
  3. Wrapping and Braces --> Assignment statement
  4. Activate Align consecutive assignments option

这篇关于IntelliJ中变量定义的空格/对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 22:50