vscode中怎样格式化js代码

一、安装插件: Pretty Formatter

  Windows上的Visual Studio代码 - Shift+ Alt+F

二、关闭文件自动化保存

菜单文件 → 首选项 → 工作区设置

{ // Controls if the editor should automatically format the line after typing

    "beautify.onSave": true,

    "editor.formatOnSave": true,

    // You can auto format any files based on the file extensions type.

    "beautify.JSfiles": [

        "js",

        "json",

        "jsbeautifyrc",

        "jshintrc",

        "ts"

    ]
}

  

 

纸上得来终觉浅,绝知此事要躬行。
原文地址:https://www.cnblogs.com/cbugs/p/15251343.html