一、在程序中打斷點調試:PHP Debug
二、高級自動完成和重構支持(代碼智能提示):PHP IntelliSense
配置:
"php.suggest.basic": false, // 插件作者建議禁用VS代碼內置的PHP智能感知設置php.suggest.basic,以false避免重復的建議
"php.validate.executablePath": "D://phpStudy//PHPTutorial//php//php-7.2.1-nts//php.exe" //指向php可執行文件(最少在php7.0版本以上)
三、Ctrl + S自動格式化php代碼:phpfmt - PHP formatter
默認使用 PSR2 規范
四、Ctrl + S自動格式化php代碼:php cs fixer
配置:
"php-cs-fixer.onsave": true, //Ctrl + S 時格式化php代碼
"php-cs-fixer.formatHtml": true //格式化.php文件中的html代碼(html、css、js)
五、生成函數的注釋:PHP DocBlocker(/**)
六、生成自定義文件頭信息:vscode-fileheader(Ctrl + Alt + I)
七、Ctrl+; 行尾自動添加分號:macros
1.配置:
"macros": {
"end_semicolon": [ // 末尾加分號
"cursorLineEnd",
{
"command": "type",
"args": {
"text": ";"
}
}
]
}
2.keybindings.json 中設置按鍵綁定:
[{
"key": "ctrl+;",
"command": "macros.end_semicolon"
}]