1. RAE首页
  2. 前端开发

Visual Studio Code Vue.js 开发环境配置

插件安装

以下是必须安装的插件

  • Vetur 语法支持
  • ESLint 语法检查
  • Prettier 代码格式化

代码格式化配置

{
    "editor.fontSize": 16,
    "editor.fontFamily": "Source Code Pro",
    "editor.lineHeight": 36,
    "explorer.confirmDelete": false,
    // Default formatter for <template> region
    "git.enableSmartCommit": true,
    "editor.quickSuggestions": {
        "strings": true
    },
    "git.autofetch": true,
    "workbench.colorTheme": "One Dark Pro",
    "element-helper.version": "2.4",
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "explorer.confirmDragAndDrop": false,
    // vscode默认启用了根据文件类型自动设置tabsize的选项
    "editor.detectIndentation": false,
    "files.autoSave": "off",
    // 添加 vue 支持
    // "eslint.run": "onSave",
    //  #去掉代码结尾的分号
    "prettier.semi": false,
    //  #使用带引号替代双引号
    "prettier.singleQuote": true,
    // // #这个按用户自身习惯选择
    "vetur.format.defaultFormatter.html": "js-beautify-html",
    // //  #让函数(名)和后面的括号之间加个空格
    "javascript.format.insertSpaceBeforeFunctionParenthesis": false,
    "typescript.format.insertSpaceBeforeFunctionParenthesis": false,
    "vetur.format.defaultFormatterOptions": {
        "js-beautify-html": {
            "wrap_attributes": "force-aligned"
            // #vue组件中html代码格式化样式
        }
    },
    "[javascript]": {
        "editor.defaultFormatter": "vscode.typescript-language-features"
    },
    "window.zoomLevel": 0,
    "terminal.integrated.fontSize": 16,
    "[vue]": {
        "editor.defaultFormatter": "octref.vetur"
    },
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": false
    },
    "[json]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[html]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "files.exclude": {
        "**/.classpath": true,
        "**/.project": true,
        "**/.settings": true,
        "**/.factorypath": true
    },
    "workbench.sideBar.location": "left",
    "editor.formatOnSave": true,
    "vetur.format.defaultFormatter.js": "vscode-typescript",
    "eslint.codeActionsOnSave.mode": "problems",
    "eslint.enable": false,
    "eslint.format.enable": true,
    "workbench.iconTheme": "material-icon-theme"
}

原创文章,作者:RAE,来自:https://raeblog.com,如若转载,请注明出处!