vscode 的settings.json配置

方案一

{
  "workbench.iconTheme": "vscode-icons",
  // --------------------  配置eslint  --------------------
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit"
  },
  "eslint.format.enable": true,
  "eslint.validate": [
    "javascript",
    "vue",
    "html",
    "javascriptreact",
    "vue-html"
  ],
  // --------------------  配置eslint  --------------------
  // 默认格式化工具
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "[html]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[css]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[less]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[scss]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[sass]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[json]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "javascript.format.insertSpaceBeforeFunctionParenthesis": false,
  // --------------------  vetur 配置  --------------------
  "[vue]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "vetur.format.defaultFormatter.html": "js-beautify-html",
  "vetur.format.defaultFormatter.js": "prettier",
  "vetur.format.defaultFormatterOptions": {
    "js-beautify-html": {
      "wrap_attributes": "aligned-multiple"
    },
    "prettier": {
      "semi": false,
      "singleQuote": true,
      "trailingComma": "none"
    }
  },
  // --------------------  koro1FileHeader 配置  --------------------
  "fileheader.customMade": {
    "Author": "AuthorName",
    "Date": "Do not edit",
    "LastEditors": "AuthorName",
    "LastEditTime": "Do not edit",
    "Description": ""
  },
  "fileheader.cursorMode": {
    "description": "",
    "param": "params",
    "return": ""
  },
  "fileheader.configObj": {
    "createHeader": false,
    "autoAdd": false,
    "openFunctionParamsCheck": true,
    "createFileTime": true,
    "dateFormat": "YYYY-MM-DD HH:mm:ss",
    "atSymbol": ["@", "@"],
    "colon": [": ", ": "]
  },
  // --------------------  prettier 配置  --------------------
  "prettier.useEditorConfig": false,
  "prettier.semi": false,
  "prettier.singleQuote": true,
  "prettier.trailingComma": "none",
  "git.confirmSync": false,
  "security.workspace.trust.untrustedFiles": "open",
  "workbench.settings.applyToAllProfiles": [
  
  ],
  "editor.fontSize": 18,
  "git.autofetch": true,
  "Codegeex.License": "",
  "editor.tabSize": 2
}

方案二

{
    "workbench.iconTheme": "vscode-icons",
    // --------------------  配置eslint  --------------------
    //autoFixedOnSave 设置已废弃,采用如下新的设置,新版(>1.41.0)配置
    "editor.codeActionsOnSave": {
      "source.fixAll.eslint": "explicit"
    },
    "eslint.format.enable": true,
    //autoFix默认开启,只需输入字符串数组即可
    "eslint.validate": [
      "javascript",
      "vue",
      "html",
      "javascriptreact",
      "vue-html"
    ],
    // --------------------  配置eslint  --------------------
    // 设置编辑器的默认格式化工具
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "[html]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[javascript]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[css]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[less]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[scss]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[sass]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    // "[css]": {
    //   "editor.defaultFormatter": "aeschli.vscode-css-formatter"
    //   },
    //   "[scss]": {
    //     "editor.defaultFormatter": "michelemelluso.code-beautifier"
    //   },
  
    "[json]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    //方法括号之间插入空格
    "javascript.format.insertSpaceBeforeFunctionParenthesis": false,
    // --------------------  vetur 配置  --------------------
    // vue文件默认格式化工具:vetur
    "[vue]": {
      // "editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
      // "editor.defaultFormatter": "octref.vetur"
      // "editor.defaultFormatter": "Vue.volar"
    },
    // 这个按用户自身习惯选择
    "vetur.format.defaultFormatter.html": "js-beautify-html",
    // 让vue中的js按编辑器自带的ts格式进行格式化
    //  "vetur.format.defaultFormatter.js": "vscode-typescript",
    // 让vue中的js按prettier进行格式化 用这个
    "vetur.format.defaultFormatter.js": "prettier",
    "vetur.format.defaultFormatterOptions": {
      "js": "prettier",
      "js-beautify-html": {
        "wrap_attributes": "aligned-multiple" //当超出折行长度时,将属性进行垂直对齐
      },
      "prettyhtml": {
        "tabWidth": 4, // 会忽略vetur的tabSize配置
        "printWidth": 100, //每行100字符
        "singleQuote": true, //是否使用单引号
        "semi": false, // 句尾是否加;
        "wrapAttributes": false,
        "sortAttributes": false
      },
      //vue中的js生效
      "prettier": {
        "semi": false, // 句尾是否加;
        "singleQuote": true, //是否使用单引号
        "trailingComma": "none" //禁止随时添加逗号
      }
    },
    // --------------------  vetur 配置  --------------------
    // --------------------  koro1FileHeader 配置  --------------------
    // 头部注释
    "fileheader.customMade": {
      "Author": "AuthorName",
      "Date": "Do not edit", // 文件创建时间(不变)
      "LastEditors": "AuthorName", // 文件最后编辑者
      "LastEditTime": "Do not edit", // 文件最后编辑时间
      "Description": ""
      // "FilePath": "only file name", // 只有文件名
      // "custom_string_obkoro1_copyright": "Copyright (C) ${now_year} AuthorName. All rights reserved.",
      // "custom_string_obkoro1_date": "Do not edit" // 不带Date前缀的时间
    },
    // 函数注释
    "fileheader.cursorMode": {
      "description": "",
      //"custom_string_obkoro1": "",
      "param": "params",
      "return": ""
    },
    // 插件配置项
    "fileheader.configObj": {
      "createHeader": false, // 新建文件自动添加头部注释,默认打开
      "autoAdd": false, // 保存自动添加头部注释,开启才能自动添加,默认开启
      "openFunctionParamsCheck": true, //函数注释自动提取函数的参数,默认开启
      "createFileTime": true, // 默认为此文件的创建时间,设为false更改为当前生成注释的时间
      "dateFormat": "YYYY-MM-DD HH:mm:ss", // 默认时间格式,修改影响所有时间字段
      // 自定义注释中的艾特和冒号:
      "atSymbol": ["@", "@"], // 所有文件的头部注释和函数注释的默认值 @
      "colon": [": ", ": "] // 所有文件的头部注释和函数注释的默认值 :
      // 自定义特殊字段名,Date、LastEditTime、LastEditors、Description、FilePath
      // "specialOptions": {
      //   "Date": "since",
      //   "LastEditTime": "lastTime",
      //   "LastEditors": "LastAuthor",
      //   "Description": "message",
      //   "FilePath": "文件相对于项目的路径"
      // }
      // 函数参数配置
      // "functionParamsShape": "normal", // 正常
      // "functionParamsShape": "no bracket", // 没有方括号
      // "functionParamsShape": "no type", // 没有类型
      // "functionParamsShape": [ "{", "}"], // 函数参数外形自定义,默认值 {}
      // "functionTypeSymbol": "*", // 参数没有类型时的默认值 *
      // 函数设置不添加参数和类型 {*}
      // "functionParamsShape": "no type", // 没有类型
      // "functionTypeSymbol": "" // 参数没有类型时的默认值 *
    },
    // --------------------  koro1FileHeader 配置  --------------------
    // --------------------  prettier 配置(以下配置主要针对.js)  --------------------
    "prettier.useEditorConfig": false, // 不使用editorConfig配置文件设置才生效
    "prettier.semi": false, // 句尾是否加;
    "prettier.singleQuote": true, //是否使用单引号
    "prettier.trailingComma": "none", //禁止随时添加逗号
    // --------------------  prettier 配置  --------------------
    "git.confirmSync": false,
    "security.workspace.trust.untrustedFiles": "open",
    "workbench.settings.applyToAllProfiles": [
    ],
    "editor.fontSize": 18,
    "git.autofetch": true
  }
  

方案三

{
  "workbench.iconTheme": "vscode-icons",
  // --------------------  配置eslint  --------------------
  //autoFixedOnSave 设置已废弃,采用如下新的设置,新版(>1.41.0)配置
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit"
  },
  "eslint.format.enable": true,
  //autoFix默认开启,只需输入字符串数组即可
  "eslint.validate": [
    "javascript",
    "vue",
    "html",
    "javascriptreact",
    "vue-html"
  ],
  // --------------------  配置eslint  --------------------
  // 设置编辑器的默认格式化工具
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "[html]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[css]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[less]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[scss]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[sass]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  // "[css]": {
  //   "editor.defaultFormatter": "aeschli.vscode-css-formatter"
  //   },
  //   "[scss]": {
  //     "editor.defaultFormatter": "michelemelluso.code-beautifier"
  //   },

  "[json]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  //方法括号之间插入空格
  "javascript.format.insertSpaceBeforeFunctionParenthesis": false,
  // --------------------  vetur 配置  --------------------
  // vue文件默认格式化工具:vetur
  "[vue]": {
    // "editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
    // "editor.defaultFormatter": "octref.vetur"
    // "editor.defaultFormatter": "Vue.volar"
  },
  // 这个按用户自身习惯选择
  "vetur.format.defaultFormatter.html": "js-beautify-html",
  // 让vue中的js按编辑器自带的ts格式进行格式化
  //  "vetur.format.defaultFormatter.js": "vscode-typescript",
  // 让vue中的js按prettier进行格式化 用这个
  "vetur.format.defaultFormatter.js": "prettier",
  "vetur.format.defaultFormatterOptions": {
    "js": "prettier",
    "js-beautify-html": {
      "wrap_attributes": "aligned-multiple" //当超出折行长度时,将属性进行垂直对齐
    },
    "prettyhtml": {
      "tabWidth": 4, // 会忽略vetur的tabSize配置
      "printWidth": 100, //每行100字符
      "singleQuote": true, //是否使用单引号
      "semi": false, // 句尾是否加;
      "wrapAttributes": false,
      "sortAttributes": false
    },
    //vue中的js生效
    "prettier": {
      "semi": false, // 句尾是否加;
      "singleQuote": true, //是否使用单引号
      "trailingComma": "none" //禁止随时添加逗号
    }
  },
  // --------------------  vetur 配置  --------------------
  // --------------------  koro1FileHeader 配置  --------------------
  // 头部注释
  "fileheader.customMade": {
    "Author": "AuthorName",
    "Date": "Do not edit", // 文件创建时间(不变)
    "LastEditors": "AuthorName", // 文件最后编辑者
    "LastEditTime": "Do not edit", // 文件最后编辑时间
    "Description": ""
    // "FilePath": "only file name", // 只有文件名
    // "custom_string_obkoro1_copyright": "Copyright (C) ${now_year} AuthorName. All rights reserved.",
    // "custom_string_obkoro1_date": "Do not edit" // 不带Date前缀的时间
  },
  // 函数注释
  "fileheader.cursorMode": {
    "description": "",
    //"custom_string_obkoro1": "",
    "param": "params",
    "return": ""
  },
  // 插件配置项
  "fileheader.configObj": {
    "createHeader": false, // 新建文件自动添加头部注释,默认打开
    "autoAdd": false, // 保存自动添加头部注释,开启才能自动添加,默认开启
    "openFunctionParamsCheck": true, //函数注释自动提取函数的参数,默认开启
    "createFileTime": true, // 默认为此文件的创建时间,设为false更改为当前生成注释的时间
    "dateFormat": "YYYY-MM-DD HH:mm:ss", // 默认时间格式,修改影响所有时间字段
    // 自定义注释中的艾特和冒号:
    "atSymbol": ["@", "@"], // 所有文件的头部注释和函数注释的默认值 @
    "colon": [": ", ": "] // 所有文件的头部注释和函数注释的默认值 :
    // 自定义特殊字段名,Date、LastEditTime、LastEditors、Description、FilePath
    // "specialOptions": {
    //   "Date": "since",
    //   "LastEditTime": "lastTime",
    //   "LastEditors": "LastAuthor",
    //   "Description": "message",
    //   "FilePath": "文件相对于项目的路径"
    // }
    // 函数参数配置
    // "functionParamsShape": "normal", // 正常
    // "functionParamsShape": "no bracket", // 没有方括号
    // "functionParamsShape": "no type", // 没有类型
    // "functionParamsShape": [ "{", "}"], // 函数参数外形自定义,默认值 {}
    // "functionTypeSymbol": "*", // 参数没有类型时的默认值 *
    // 函数设置不添加参数和类型 {*}
    // "functionParamsShape": "no type", // 没有类型
    // "functionTypeSymbol": "" // 参数没有类型时的默认值 *
  },
  // --------------------  koro1FileHeader 配置  --------------------
  // --------------------  prettier 配置(以下配置主要针对.js)  --------------------
  "prettier.useEditorConfig": false, // 不使用editorConfig配置文件设置才生效
  "prettier.semi": false, // 句尾是否加;
  "prettier.singleQuote": true, //是否使用单引号
  "prettier.trailingComma": "none", //禁止随时添加逗号
  // --------------------  prettier 配置  --------------------
  "git.confirmSync": false,
  "security.workspace.trust.untrustedFiles": "open",
  "workbench.settings.applyToAllProfiles": [
  


  ],
  "editor.fontSize": 18,
  "git.autofetch": true,
// 头部注释
"fileheader.customMade": {
  // Author字段是文件的创建者 可以在specialOptions中更改特殊属性
  // 公司项目和个人项目可以配置不同的用户名与邮箱 搜索: gitconfig includeIf  比如: https://ayase.moe/2021/03/09/customized-git-config/
  // 自动提取当前git config中的: 用户名、邮箱
  "Author": "git config user.name && git config user.email", // 同时获取用户名与邮箱
  // "Author": "git config user.name", // 仅获取用户名
  // "Author": "git config user.email", // 仅获取邮箱
  // "Author": "OBKoro1", // 写死的固定值 不从git config中获取
  "Date": "Do not edit", // 文件创建时间(不变)
  // LastEditors、LastEditTime、FilePath将会自动更新 如果觉得时间更新的太频繁可以使用throttleTime(默认为1分钟)配置更改更新时间。
  "LastEditors": "git config user.name && git config user.email", // 文件最后编辑者 与Author字段一致
  // 由于编辑文件就会变更最后编辑时间,多人协作中合并的时候会导致merge
  // 可以将时间颗粒度改为周、或者月,这样冲突就减少很多。搜索变更时间格式: dateFormat
  "LastEditTime": "Do not edit", // 文件最后编辑时间
  // 输出相对路径,类似: /文件夹名称/src/index.js
  "FilePath": "Do not edit", // 文件在项目中的相对路径 自动更新
  // 插件会自动将光标移动到Description选项中 方便输入 Description字段可以在specialOptions更改
  "Description": "", // 介绍文件的作用、文件的入参、出参。
  // custom_string_obkoro1~custom_string_obkoro100都可以输出自定义信息
  // 可以设置多条自定义信息 设置个性签名、留下QQ、微信联系方式、输入空行等
  "custom_string_obkoro1": "", 
  // 版权声明 保留文件所有权利 自动替换年份 获取git配置的用户名和邮箱
  // 版权声明获取git配置, 与Author字段一致: ${git_name} ${git_email} ${git_name_email}
  "custom_string_obkoro1_copyright": "Copyright (c) ${now_year} by ${git_name_email}, All Rights Reserved. "
  // "custom_string_obkoro1_copyright": "Copyright (c) ${now_year} by 写死的公司名/用户名, All Rights Reserved. "
},
// 函数注释
"fileheader.cursorMode": {
  "description": "", // 函数注释生成之后,光标移动到这里
  "param": "", // param 开启函数参数自动提取 需要将光标放在函数行或者函数上方的空白行
  "return": "",
}

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。