prettier / prettier-vscode

Visual Studio Code extension for Prettier
https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
MIT License
5.17k stars 457 forks source link

Support prettier option `pluginSearchDirs` #2881

Open vuolter opened 1 year ago

vuolter commented 1 year ago

The option pluginSearchDirs is supported by prettier's configuration file: https://prettier.io/docs/en/plugins.html#using-plugins.

Setting this option directly in the vscode extension will allow to manage the prettier's plugin discovery, definitely useful to workaround these issues: https://github.com/prettier/prettier/issues/8056 https://github.com/withastro/prettier-plugin-astro/issues/97

Think about this. Thank you. 😉

fisker commented 1 year ago

FYI: Prettier is removing this option.

eldair commented 1 year ago

@fisker any other ideas on how to solve those issues mentioned above (plugin(s) not detectable by vscode)?

fisker commented 1 year ago

Put {plugins: []} in your .prettierrc.

eldair commented 1 year ago

Yeah, tried that :/ but not working when installing with pnpm :/ EDIT: unless you mean to put an empty array, I didn't try that

fisker commented 1 year ago

If it doesn't work, it's bug in prettier, you can open an issue on prettier repo.

You can also try

// prettier.config.cjs
module.exports = {
  plugins: [require("your-plugin")]
};

OR

// prettier.config.cjs
module.exports = {
  plugins: [require.resolve("your-plugin")]
};
eldair commented 1 year ago

@fisker thanks for the suggestions, I will try those as well :)