zoukankan      html  css  js  c++  java
  • vscode:vue文件保存自动格式化

    安装插件:

    1)  ESLint: eslint编码规范

    2)  Vetur: vue格式化代码

    3)  Chinese (Simplified) Language Pack for Visual Studio Code: 中文包

    添加配置:

    ctrl + shift + p > Configure Language Specific Settings > Vue > 编辑文件.

    文件内容:

    {
      // 主题
      "workbench.colorTheme": "Monokai",
      // vscode默认启用了根据文件类型自动设置tabsize的选项
      "editor.detectIndentation": false,
      // 重新设定tabsize
      "editor.tabSize": 2,
      // #每次保存的时候自动格式化
      "editor.formatOnSave": true,
      // #每次保存的时候将代码按eslint格式进行修复
      "eslint.autoFixOnSave": true,
      // 添加 vue 支持
      "eslint.validate": [
        "javascript",
        "javascriptreact",
        {
          "language": "vue",
          "autoFix": true
        }
      ],
      // #让函数(名)和后面的括号之间加个空格
      "javascript.format.insertSpaceBeforeFunctionParenthesis": false,
      // #让vue中的js按编辑器自带的ts格式进行格式化
      "vetur.format.defaultFormatter.js": "vscode-typescript",
      // #这个按用户自身习惯选择
      "vetur.format.defaultFormatter.html": "js-beautify-html",
      "vetur.format.defaultFormatterOptions": {
        "js-beautify-html": {
          // #vue组件中html代码格式化样式
          "wrap_attributes": "force-expand-multiline"
          // "wrap_attributes": "force"
          // "wrap_attributes": "force-aligned",
          // "wrap_attributes": "auto"
        }
      },
      "explorer.confirmDelete": false,
      "window.zoomLevel": 0,
      "git.enableSmartCommit": true,
      "diffEditor.ignoreTrimWhitespace": false,
      "[vue]": {},
      "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
      },
    }

      

  • 相关阅读:
    爬虫基础
    设计BBS
    中间件和auth模块
    git
    分页器与form表单
    cookie与session
    springboot2.x基础教程:@Enable原理
    springboot2.x基础教程:@Scheduled开启定时任务及源码分析
    springboot2.x基础教程:@Async开启异步任务
    springboot2.x基础教程:JRebel实现SpringBoot热部署
  • 原文地址:https://www.cnblogs.com/vs1435/p/11798670.html
Copyright © 2011-2022 走看看