[英]VS Code PHP Formatter Intelephense
I use Visual Studio Code as my editor and Intelephense as my PHP formatter.我使用 Visual Studio Code 作为我的编辑器,使用 Intelephense 作为我的 PHP 格式化程序。 It works well for the most part, but Intelephense changes my format in several ways that makes it harder for me to read.它在大多数情况下运行良好,但 Intelephense 以多种方式改变了我的格式,这让我更难阅读。 For example, I like to format my code as follows:例如,我喜欢将我的代码格式化如下:
if( $var ) {
// Do something.
}
elseif( $var ) {
// Do something.
}
But, When I save: Intelephense changes the above to:但是,当我保存时: Intelephene 将上述内容更改为:
if ($var) {
// Do something.
} elseif ($var) {
// Do something.
}
To me, that's harder to read, especially when dealing with long expressions.对我来说,这更难阅读,尤其是在处理长表达式时。 How can I configure Intelephense to format my code as in the first example?如何配置 Intelephense 以像第一个示例中那样格式化我的代码?
Extensions > PHP Intelephense > Manage(click the gear) > Find Intelephense › Format: Braces and change or Find Intelephense › Format: Enable and remove tick.扩展 > PHP Intelephense > 管理(单击齿轮)> 查找 Intelephense › 格式:大括号并更改或查找 Intelephense › 格式:启用并删除勾选。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.