步骤如下:

1)文件 ------.>【首选项】---------->【设置】;

vscdoe之通过Ctrl+S实现代码格式自动化_编程语言

2、在搜索emmet.include

vscdoe之通过Ctrl+S实现代码格式自动化_编程_02

3、添加下面的配置

{
    "editor.fontSize": 15,
    "editor.formatOnType": true,
    "editor.formatOnSave": true
}

最后,就可以实现自动格式化了。