vscode vue settings.json 代码格式化配置!

{
    // 換行
    "editor.wordWrap": "on",
    // 代码缩进修改成2个空格
    "editor.tabSize": 4,
    // 不檢查縮進,保存后統一按設置項來設置
    "editor.detectIndentation": false,
    //保存的时候自动格式化
    "editor.formatOnSave": true,
    // 字體大小
    "editor.fontSize": 14,
    // 設置行高
    "editor.lineHeight": 24,
    // 主題
    // "workbench.colorTheme": "Visual Studio Light",
    // 左側工具欄是否可見
    // "workbench.activityBar.visible": true,
    // 控制何时自动保存已更新文件。接受的值: "off"、"afterDelay"、"onFocusChange" (编辑器失去焦点)、"onWindowChange" (窗口失去焦点)。如果设置为 "afterDelay",可在 "files.autoSaveDelay" 中配置延迟时间。
    "files.autoSave": "onWindowChange",
    // "files.autoSaveDelay": 3000,
    // 让prettier使用eslint的代码格式进行校验
    // "prettier.eslintIntegration": true,
    // 去掉代码结尾的分号
    "prettier.semi": true,
    // 使用带引号替代双引号
    "prettier.singleQuote": true,
    // 启用后,按下 TAB 键,将展开 Emmet 缩写。
    "emmet.triggerExpansionOnTab": true,
    // js設置單引號
    "javascript.preferences.quoteStyle": "single",
    // 让函数(名)和后面的括号之间加个空格
    "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
    // html格式化
    "vetur.format.defaultFormatter.html": "prettier",
    // 使用eslint 風格使用standard 進行代碼規則限制
    "eslint.autoFixOnSave": true,
    "eslint.validate": [
        "javascript",
        {
            "language": "vue",
            "autoFix": true
        },
        "html",
        "vue"
    ],
    //自动保存信息
    // By default, create file  username
    "fileheader.Author": "you name",
    // By default, update file  username.
    "fileheader.LastModifiedBy": "you name",
    // By default, common template. Do not modify it!!!!!
    "fileheader.tpl": "/*\r\n * @Author: {author}\n * @Date: {createTime}\n * @Last Modified by: {lastModifiedBy}\n * @Last Modified time: {updateTime}\n */\n",
    "editor.quickSuggestions": {
        "strings": true
    },
    // vue组件中html代码格式化样式
    "vetur.format.defaultFormatterOptions": {
        "js-beautify-html": {
            "wrap_attributes": "force-aligned"
        },
        "prettyhtml": {
            "printWidth": 160, // No line exceeds 160 characters
            "singleQuote": false // Prefer double quotes over single quotes
        },
        "prettier": {
            "printWidth": 300,
            "semi": false,
            "singleQuote": true
        }
    }
}

需要安装插件 vetur  eslint prettier

猜你喜欢

转载自blog.csdn.net/weixin_43330752/article/details/100090221