「VisualStudioCode/拡張機能/php-cs-fixer」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→導入) |
(→psr12を追加) |
||
行16: | 行16: | ||
===psr12を追加=== | ===psr12を追加=== | ||
<pre> | <pre> | ||
− | "php-cs-fixer.rules": "@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 | ||
+ | } | ||
</pre> | </pre> | ||
参考:https://github.com/junstyle/vscode-php-cs-fixer | 参考: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
自動整形
ファイル保存時に自動整形される