bcarroll2k3
bcarroll2k3

Reputation: 58

VSCode disable prettier formatting when committing files

I can't find an answer for this anywhere and I'm literally ready to start pulling my hair out. I don't know how it started, but very recently VSCode has been auto-formatting my code when it's committed to github. At first I thought it was on file save, so I uninstalled prettier, set editor:formatOnSave and editor:formatOnType to false (both in the settings.json file and in the Preferences UI), but it still is formatting before save. I discovered this in the git logs:

enter image description here

I literally have uninstalled every extension I can find that I thought would prevent formatting. This is all I have installed now:

enter image description here

Does anyone know what might be happening, or where I can completely disable this? Again, the formatting is preserved until I click the checkbox at the top of the Source Control panel to commit my code. It then takes code formatted like this:

public String methodName(String param1, String param2, Integer param3) {
...

and formats it like this:

public String methodName(
  String param1,
  String param2,
  Integer param3
) {
...

I don't like this and I need it to stop. Please help me make it stop.

Thanks for any and all help!

Upvotes: 1

Views: 3047

Answers (2)

bcarroll2k3
bcarroll2k3

Reputation: 58

Sorry for the delay, I finally had a chance to get back to this. I found out the issue was that a previous extension had littered the .git/hooks directory inside my project with a bunch of scripts that weren't cleaned up on removal. I removed everything except the .sample files and all is well.

Upvotes: 2

Damian
Damian

Reputation: 78

You can run VScode from command-line - cmd.exe with all extensions disabled to narrow it down is it any extension issue:

code --disable-extensions

Upvotes: 0

Related Questions