Pat*_*cow 42 php text alignment phpstorm webstorm
我有这个文字
$test1 = 'testing1';
$test1test1 = 'testing1';
$test1test1test1 = 'testing1';
$test1 = 'testing1';
Run Code Online (Sandbox Code Playgroud)
我想像这样对齐,使用标签,
$test1 = 'testing1';
$test1test1 = 'testing1';
$test1test1test1 = 'testing1';
$test1 = 'testing1';
Run Code Online (Sandbox Code Playgroud)
有没有办法在phpstorm或webstorm中这样做?
LIA*_*IAL 57
Cmd + Alt + L(在Mac中)或Ctrl + Alt + L(Win)和PHP Storm将格式化代码取决于您在"设置"中的代码样式.要设置此代码样式,请执行以下操作:文件 - >设置 - >代码样式 - > PHP(在此处选择您的语言) - >其他 - >对齐键值对 - 标记为已选中.然后按重新格式化代码(Ctrl + Alt + L)并瞧.你会得到代码,你在上面写的风格.
maq*_*maq 21
格式化选项 phpstorm 8
设置>代码风格> php>环绕和括号

选中"选项中的对齐字段"和"对齐常量"选项
现在你可以得到你想要的!:)
小智 9
在PhpStorm 8中,该选项包括:
File -> Settings -> Code style -> PHP -> Wrapping and Braces -> Assignment statement
Run Code Online (Sandbox Code Playgroud)
Mac 上 2019.1 的视觉更新:
转到PHP Storm> Preferences> Editor> Code Style> PHP> Wrapping and Braces> Assignment Statement> Align consecutive assignments。
要激活它,请转到Code>Reformat Code或按Cmd+Opt+L。