zoukankan      html  css  js  c++  java
  • VS Code 配置推荐

    VS Code 配置推荐

    此配置包含

    • 双引号转单引号
    • 去分号
    • 去多余逗号
    • ctrl + s 自动格式化代码

    配置文件json

    // 2020年2月21日00:49:01添加
    {
      "eslint.enable": false,
      "window.zoomLevel": 1,
      // 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
        }
      ],
      // #去掉代码结尾的分号
      // "prettier.semi": true,
      // #使用单引号替代双引号
      // "prettier.singleQuote": true,
      // #让函数(名)和后面的括号之间加个空格
      // "javascript.format.insertSpaceBeforeFunctionParenthesis": false,
      // #这个按用户自身习惯选择
      "vetur.format.defaultFormatter.html": "js-beautify-html",
      // #让vue中的js按编辑器自带的ts格式进行格式化
      "vetur.format.defaultFormatter.js": "vscode-typescript",
      "vetur.format.defaultFormatterOptions": {
        "js-beautify-html": {
          "wrap_attributes": "force-aligned"
          // #vue组件中html代码格式化样式
        }
      },
      "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
      },
      "files.autoSave": "afterDelay", // import之后是否换行
      "vetur.format.defaultFormatterOptions": {
        "prettier": {
          "semi": false, // 格式化不加分号
          "singleQuote": true, // 格式化以单引号为主
          //禁止随时添加逗号,这个很重要。找了好久
          "trailingComma": "none"
        }
      },
      //分号和双引号确实不会再自动添加了,但是不会在方法括号之间插入空格,可以再加入这条配置即可
      "javascript.format.insertSpaceBeforeFunctionParenthesis": false,
      "typescript.format.insertSpaceBeforeFunctionParenthesis": true,
      "vetur.format.defaultFormatter.js": "vscode-typescript",
      // "workbench.colorTheme": "Monokai",
      "editor.matchBrackets": false,
      "workbench.iconTheme": "vscode-icons",
      "files.associations": {
        "*.vue": "vue"
      },
      "eslint.validate": [
        "javascript",
        "javascriptreact",
        "html",
        "vue",
        {
          "language": "vue",
          "autoFix": true
        }
      ],
      "eslint.autoFixOnSave": true,
      "editor.tabSize": 2,
      "terminal.integrated.shell.windows": "C:\WINDOWS\System32\cmd.exe",
      "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
      "typescript.format.insertSpaceBeforeFunctionParenthesis": true,
      "vetur.format.defaultFormatter.js": "prettier",
      "vetur.format.defaultFormatter.html": "js-beautify-html",
      "explorer.confirmDragAndDrop": false,
      // 2020年2月23日02:10:54增加切换保存
      "files.autoSave": "onFocusChange",
      "[vue]": {
        // "editor.defaultFormatter": "esbenp.prettier-vscode"
        "editor.defaultFormatter": "numso.prettier-standard-vscode"
      },
      "[javascript]": {
        "editor.defaultFormatter": "numso.prettier-standard-vscode"
      },
      "security.workspace.trust.untrustedFiles": "open"
    }
    

    插件安装/禁用情况

  • 相关阅读:
    URL编码及解码
    Javascript解析URL
    为什么在JavaScript中0.1+0.2不等于0.3?
    void 0 与 undefined
    Windows7、Windows10下把Git Bash Here 添加到右键菜单(ContextMenu)
    [菜鸟]C++创建类对象时(无参)后不加括号与加括号的区别
    git常用命令
    git 出错及解决
    Vim升华之树形目录插件NERDTree安装图解
    rails.vim环境安装(ubuntu)
  • 原文地址:https://www.cnblogs.com/zhangruifeng/p/15215248.html
Copyright © 2011-2022 走看看