当我在 VSCode 中点击“保存”时,prettier-tailwind-plugin 未按预期工作

Adr*_*ngh 7 plugins visual-studio-code prettier tailwind-css

我安装了 prettier-plugin-tailwindcss,当我使用 运行 Prettier 时,它成功地对 Tailwind 类进行了排序npx prettier --write index.html。但是,当我在 VScode 中点击“保存”时,prettier-plugin-tailwindcss 不会按预期对 Tailwind 类进行排序。

我正在关注本教程和本文档。正如您所看到的,我正确设置了开发依赖项,并且.prettierrc.json在项目中有一个。``

包.json

.prettierrc.json

我期望当我点击“保存”时,它会自动按预期工作,即对顺风类进行排序,但该插件仅在使用运行 prettier 时才有效npx prettier --write index.html

我尝试过的事情:

我将保存格式设置为 true 并设置路径,但没有解决问题。

设置

小智 1

转到Settings > Text Editor > Formatting并选择“保存时格式化”。