prettier / prettier-vscode

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

Extension only looks for .gitignore or .prettierignore when using Prettier v3, does not allow both #3361

Open MWhite-22 opened 1 month ago

MWhite-22 commented 1 month ago

Summary

I am using extension version 10.4 with prettier version 3.2.5 installed in my local node_modules.

Prettier v3 picks up both the .prettierignore files and the .gitignore file by default when running.

I assumed the extension would do the same now that it is using Prettier v3 does is does not appear to be doing that. It will only select the one specified in the prettier.ignore_path setting.

I've tried setting it to empty, null, .gitignore, and the default .prettierignore and none have the desired outcome.

Steps To Reproduce:

  1. Have a project with a .gitignore and a .prettierignore file that reference different paths
  2. Run npx prettier --write . and see that it will ignore all the files referenced in both locations
  3. Run the vscode extensions format functionality
  4. It'll only ignore the files in .prettierignore by default, or only .gitignore if the setting is changed

Expected result

When using prettier v3, both the .gitignore AND .prettierignore should be used to decide if a file is ignored or not.

Actual result

Only one file is used, whichever is setup in the prettier.ignore_path settings.

VS Code Version:

Version: 1.87.2 (Universal) Commit: 863d2581ecda6849923a2118d93a088b0745d9d6 Date: 2024-03-08T15:21:31.043Z Electron: 27.3.2 ElectronBuildId: 26836302 Chromium: 118.0.5993.159 Node.js: 18.17.1 V8: 11.8.172.18-electron.0 OS: Darwin arm64 23.4.0

Prettier Extension Version: 10.4