-
Notifications
You must be signed in to change notification settings - Fork 13
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
[Bug] Identify and apply a single JSON formatting #2786
Comments
Formatting when saving file in VS CodeIn my environment, opening and saving the file This formatting on saving is configured in For some reason, the extension does not seem to be installed in my dev container:
Note that there are other extensions specified for the dev container that show this message:
Stepping outside of the dev container to be in the EC2 (SSH): Closing the remote connection to be on my local VS Code client. That's where the Prettier extension is actually installed. For the bug at hand, I'm going to assume that the Prettier VS Code extension works the same way independently on where it is installed. The type of file detected by VS Code (this is not a formatter): Back inside the dev container, the Prettier extension is not recognized as a valid value when the extension is installed outside of the dev container (in this case directly on the VS Code client): After installing the Prettier extension inside the container, the are two changes: 1) the formatter ID is now valid in Other observations:
|
Setting |
Whatever I do, it seems that the default VS Code formatter for JSON kicks in, even if I configure vscode.json-language-features syntax: Prettier CLI generates a format ("compact") different from the format created when saving the file in VS Code ("expanded").
I know that the Prettier service (VS Code extension) is reading the correct config file as it prints:
Confirmed that the Prettier CLI reads the config file |
I found that specifying multiple languages for the same config as illustrated in microsoft/vscode#138076 prevents Prettier from formatting JSON and JSONC files. This does not work, i.e. the default VS Code JSON formatter is applied instead of Prettier (yet the syntax is valid according to the issue referenced above):
But this works:
|
My VS Code version: 1.92.2 |
Is there an existing issue for this?
What product(s) are you seeing the problem on?
Sage Monorepo
Current behavior
It appears that there are two different formatting styles being used for JSON files. This inconsistency unnecessarily increases the amount of code to review in PRs, making the review process more cumbersome.
Observations
Files that have seen their format changing:
tsconfig.base.json
project.json
Expected behavior
No response
Anything else?
Cc: @sagely1
Commit ID
No response
Are you developing inside the dev container?
Code of Conduct
The text was updated successfully, but these errors were encountered: