Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code html formatting doesn't work

Code formatting doesn't seem work in Visual Studio Code. I have tried with shift+alt+f, but it wouldn't format html code. I run ctrl+shift+p and type Format and only option I have is Format Document(shift+alt+f) and Format Selection (don't have Format code). I don't understand what I' doing wrong? Do I need to install some kind of extension in order for this formatting to work on html files?

like image 860
mismas Avatar asked Dec 02 '16 16:12

mismas


2 Answers

This worked for me:

  1. Right click inside html file that is being edited.
  2. Select "Format Document With...".
  3. Selected "Configure Default Formatter ...".
  4. Changed from "Prettier - Code formatter" to "HTML Language Features".
like image 190
Danny Remington - OMS Avatar answered Sep 20 '22 07:09

Danny Remington - OMS


This worked for me in Visual Studio 2015 (VS2015):

  1. Right-click on the code window with the HTML you want to format
  2. Click 'Un-minify" in the popup menu.

That worked for me when Format Document (Ctrl-K, Ctrl-D) and Format Selection (Ctrk-K, Ctrl-F) failed to format HTML that I pasted into a Visual Studio HTML document.

like image 40
hoekma Avatar answered Sep 22 '22 07:09

hoekma