Aptana PHP格式化程序 - 使用自定义格式化规则 [英] Aptana PHP Formatter - use custom formatting rules
问题描述
我在PHP文档中使用了Apatana的格式化功能,除了数组转换之外,它运行良好:
$ data = array(
'email'=> $ params ['email'],
'username'=> $ params ['username'],
);
变成这个:
$ data = array('email'=> $ params ['email'],'username'=> $ params ['username']);
有没有办法避免这种情况并设置自定义格式规则?
是的。
有一种方法。
转到Studio的首选项并找到'Formatter'项目。如果您使用的是默认格式化器配置文件,请通过单击+图标来创建一个新的格式器配置文件。
单击以编辑PHP格式设置(双击PHP '项目,或单击它,然后单击'编辑'按钮)。
在新行选项卡下,选中插入新行创造元素。确定对话框。确保刚刚创建的配置文件是格式化程序首选项页面中选定的配置文件,并对代码进行格式化。
干杯
I'm using Apatana's formatting features in PHP documents, it works well except with arrays where it transform this:
$data = array(
'email' => $params['email'],
'username' => $params['username'],
);
into this:
$data = array('email' => $params['email'], 'username' => $params['username']);
is there a way to avoid this and set custom formatting rules?
Yes. There is a way.
Go to the Studio's preferences and locate the 'Formatter' item. If you are using the default formatter profile, create a new one by clicking the '+' icon.
Click to edit the PHP formatting setting (double-click the 'PHP' item, or click it and than click the 'Edit' button).
Under the 'New Lines' tab, check the option to 'Insert new line between array-creation elements'. OK the dialogs. Make sure that the profile you just created is the selected one in the formatter preferences page, and format your code.
Cheers
这篇关于Aptana PHP格式化程序 - 使用自定义格式化规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!