0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

VSCodeでPHPのprettierを設定する方法

Posted at

Run on saveなどいろいろ試したんですが機能しなかったので
シンプルにnpmモジュールをインストールする方法でいけました。

プロジェクト配下のpackage.jsonに下記を記載

package.json
{
  "devDependencies": {
    "@prettier/plugin-php": "*",
    "prettier": "*"
  }
}

プロジェクト配下のディレクトリでnpm installを実行

VSCodeの設定で「Editor: Format On Save」をon
VSCodeを再起動でprettierは有効になってます。(htmlを含むphpファイルは効かないようです)

なお、VSCodeの拡張機能の方のprettierは使わないため
その設定Editor: Default Formatterは「なし」のままです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?