Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettier does not format in multi-folder repositories whilst using the .code-workspace config. #3201

Closed
aidanm1999 opened this issue Nov 16, 2023 · 4 comments
Labels
locked Please open a new issue and fill out the template instead of commenting. Stale

Comments

@aidanm1999
Copy link

Summary

Prettier does not format in multi-folder repositories whilst using the .code-workspace config.

Github Repository to Reproduce Issue

https://github.com/aidanm1999/prettier-vscode-multi-workspace-config

This repository is set up like so:

  • workspace-1 - a folder containing a dummy JSON document to simulate formattable files
  • group-1 - a folder containing 2 workspaces
    • workspace-2 - a folder containing a dummy JSON document to simulate formattable files
    • workspace-3 - a folder containing a dummy JSON document to simulate formattable files
  • .prettierrc - default prettier config
  • .prettierignore - default prettier ignore config
  • repo.code-workspace - file containing workspace config

Steps To Reproduce:

  1. Open the repository through the repo.code-workspace
  2. This will open the repo with workspaces
  3. Open the Prettier output pane
  4. Open repo.code-workspace and comment out folders 1, 2 and 3
    • This is to ensure the files open through the 'Root' folder
  5. Then open any of the JSON documents and format the file
  6. Should format successfully
  7. Uncomment the folders in the repo.code-workspace
  8. Now re-open the document and try to format

Expected result

The Prettier output should have logged a successful reformat

Actual result

The prettier output errors out:

["INFO" - 17:04:20] Formatting file:///Users/me/Developer/prettier-vscode-multi-workspace-config/group-1/workspace-2/doc.json
["ERROR" - 17:04:20] Invalid prettier configuration file detected.
["ERROR" - 17:04:20] ENOENT: no such file or directory, open '/Users/me/Developer/prettier-vscode-multi-workspace-config/group-1/workspace-2/.prettierrc'
Error: ENOENT: no such file or directory, open '/Users/me/Developer/prettier-vscode-multi-workspace-config/group-1/workspace-2/.prettierrc'

Now this would be fine if you could write ${workspaceFolder:Root}/.prettier, however this does not resolve:

Error: ENOENT: no such file or directory, open '/Users/me/Developer/prettier-vscode-multi-workspace-config/group-1/workspace-2/${workspaceFolder:Root}/.prettierrc'

It would be ideal if the Prettier extension could resolve the workspaceFolder or bubble up a search to look at parent, grandparent or great-grandparent directories.

Additional information

VS Code Version: 1.84.2

Prettier Extension Version: 10.1.0

OS and version: MacOS Sonoma 14.1

Prettier Log Output

Relevant logs logged above

Copy link

This issue has been labeled as stale due to inactivity. Reply to keep this issue open.

@github-actions github-actions bot added the Stale label Jan 16, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 23, 2024
@aidanm1999
Copy link
Author

Still an issue

1 similar comment
@jhgeluk
Copy link

jhgeluk commented Jan 25, 2024

Still an issue

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot added the locked Please open a new issue and fill out the template instead of commenting. label Apr 25, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked Please open a new issue and fill out the template instead of commenting. Stale
Projects
None yet
Development

No branches or pull requests

2 participants