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

I have done all kinds of things but my prettier does not format on save. #3382

Open
Tochiskool opened this issue Apr 26, 2024 · 1 comment
Open

Comments

@Tochiskool
Copy link

Type: Bug

I installed prettier, on user I checked format on save and checked the config. Well it does not format on save I have followed all kinds of videos but it doesnot work. I think I did something wrong with the path. I even tried to uninstall it completely then reinstall it but no way. I can connect with my screen and help me I will be more than grateful.

Extension version: 10.4.0
VS Code version: Code 1.85.1 (Universal) (0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2, 2023-12-13T09:48:06.308Z)
OS version: Darwin arm64 23.4.0
Modes:

System Info
Item Value
CPUs Apple M2 (8 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 2, 2, 2
Memory (System) 8.00GB (0.09GB free)
Process Argv . --crash-reporter-id 5cc55de9-b76b-4d72-8998-1386ad96241d
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscoreces:30445986
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
welcomedialog:30910333
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
d34g3935:30971562
bg6jg535:30979843
ccp2r3:30993541
dsvsc020:30976470
pythonait:31006305
gee8j676:31009558
showvideot:31016892
dsvsc021:30996838
f3je6385:31013174
pythoncenvptcf:31022791

@md-durjoy
Copy link

To fix the issue with Prettier not formatting on save in Visual Studio Code, you can follow these steps:

Check Prettier Configuration:
Make sure your Prettier configuration is set up correctly. Ensure that you have a valid prettier.config.js or .prettierrc file in your project root directory with the desired formatting rules.

Verify VS Code Settings:
Open your VS Code settings (settings.json) and confirm that the "editor.formatOnSave" setting is enabled. You can enable it by adding or updating the following line in your settings:

json

"editor.formatOnSave": true

Check for Conflicting Extensions:
Disable any other formatting extensions you have installed in VS Code temporarily to see if they might be conflicting with Prettier. Sometimes, multiple formatting extensions can interfere with each other.

Verify Prettier Extension Settings:
Ensure that the Prettier extension is properly configured in VS Code. Open the extensions view (Ctrl+Shift+X), search for "Prettier - Code formatter", and click on the gear icon to access its settings. Make sure that the "Format On Save" option is enabled.

Restart VS Code:
After making changes to settings or extensions, it's a good idea to restart VS Code to ensure that the changes take effect.

Check Output Panel for Errors:
Open the VS Code output panel (View -> Output) and select "Prettier" from the dropdown. Look for any error messages or warnings related to Prettier. These messages might provide insights into what's going wrong.

Reinstall Prettier Extension:
If none of the above steps resolve the issue, you can try reinstalling the Prettier extension. You mentioned that you've already tried this, but it's worth another attempt.

Verify Path Configuration (if relevant):
If you suspect that there's a path issue related to Prettier, double-check that the path to the Prettier executable is correctly configured in your VS Code settings. You can set the path explicitly using the "prettier.prettierPath" setting in your VS Code settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants