「VisualStudioCode/拡張機能/php-cs-fixer」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→導入) |
(→psr12を追加) |
||
(同じ利用者による、間の2版が非表示) | |||
行7: | 行7: | ||
"php-cs-fixer.executablePath": "${extensionPath}/php-cs-fixer.phar", | "php-cs-fixer.executablePath": "${extensionPath}/php-cs-fixer.phar", | ||
"php-cs-fixer.onsave": true, | "php-cs-fixer.onsave": true, | ||
− | "php-cs-fixer.formatHtml": | + | "php-cs-fixer.formatHtml": false, |
"[php]": { | "[php]": { | ||
"editor.defaultFormatter": "junstyle.php-cs-fixer" | "editor.defaultFormatter": "junstyle.php-cs-fixer" | ||
行13: | 行13: | ||
</pre> | </pre> | ||
参考:https://codewithsusan.com/notes/php-cs-fixer-in-vscode | 参考:https://codewithsusan.com/notes/php-cs-fixer-in-vscode | ||
+ | |||
+ | ===psr12を追加=== | ||
+ | <pre> | ||
+ | { | ||
+ | "editor.formatOnSave": true, | ||
+ | "php-cs-fixer.executablePath": "${extensionPath}/php-cs-fixer.phar", | ||
+ | "php-cs-fixer.onsave": false, | ||
+ | "php-cs-fixer.rules": "@PSR12", | ||
+ | "php-cs-fixer.config": ".php-cs-fixer.php;.php-cs-fixer.dist.php;.php_cs;.php_cs.dist", | ||
+ | "php-cs-fixer.allowRisky": false, | ||
+ | "php-cs-fixer.pathMode": "override", | ||
+ | "php-cs-fixer.ignorePHPVersion": false, | ||
+ | "php-cs-fixer.exclude": [], | ||
+ | "php-cs-fixer.autoFixByBracket": false, | ||
+ | "php-cs-fixer.autoFixBySemicolon": false, | ||
+ | "php-cs-fixer.formatHtml": false, | ||
+ | "php-cs-fixer.documentFormattingProvider": true | ||
+ | } | ||
+ | </pre> | ||
+ | 参考:https://github.com/junstyle/vscode-php-cs-fixer | ||
==自動整形== | ==自動整形== |
2024年12月17日 (火) 00:49時点における最新版
導入
- vscodeのメニューの基本/拡張機能
- "php cs fixer"を検索
- php cs fixerをインストール
.vscode/setting.json に以下追加
"php-cs-fixer.executablePath": "${extensionPath}/php-cs-fixer.phar", "php-cs-fixer.onsave": true, "php-cs-fixer.formatHtml": false, "[php]": { "editor.defaultFormatter": "junstyle.php-cs-fixer" },
参考:https://codewithsusan.com/notes/php-cs-fixer-in-vscode
psr12を追加
{ "editor.formatOnSave": true, "php-cs-fixer.executablePath": "${extensionPath}/php-cs-fixer.phar", "php-cs-fixer.onsave": false, "php-cs-fixer.rules": "@PSR12", "php-cs-fixer.config": ".php-cs-fixer.php;.php-cs-fixer.dist.php;.php_cs;.php_cs.dist", "php-cs-fixer.allowRisky": false, "php-cs-fixer.pathMode": "override", "php-cs-fixer.ignorePHPVersion": false, "php-cs-fixer.exclude": [], "php-cs-fixer.autoFixByBracket": false, "php-cs-fixer.autoFixBySemicolon": false, "php-cs-fixer.formatHtml": false, "php-cs-fixer.documentFormattingProvider": true }
参考:https://github.com/junstyle/vscode-php-cs-fixer
自動整形
ファイル保存時に自動整形される