Home > Software design >  Unable to use Format Document tool for VSCode when coding in HTML. No problems with Python
Unable to use Format Document tool for VSCode when coding in HTML. No problems with Python

Time:03-28

I am using VSCode to learn web design as I have used VSCode in the past for Python. While I was coding in Python, the document format tool worked just fine, even the though I moved on to PyCharm. Now that I am using VSCode for HTML/CSS, the format tool just doesn't seem to work at all. I tried adding the prettier extension and adding it as the default format tool, but that didn't work. Beyond just reinstalling VScode, is there something I missed. Thanks.

Again, I tried adding the prettier extension to the default format tool.

CodePudding user response:

I'm an enthusiast, hope these will help.

  • Re-install & restart VSCode
  • Check settings to see if you actually activated it
  • ...

CodePudding user response:

The prettier extension requires a little bit of configuration to work. First you need to make sure it’s your default formatter. In the settings on the top right there will be a button for viewing settings in json format. click it then add this to the file

{
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  }
}

Then you will probably want to format on save. Add this as well:

"editor.formatOnSave": false

That should get it working.

  • Related