一、打开vscode ,点击左下角图标点击设置,在搜索框中输入setting json,点击在setting json中编辑。
二、设置setting json文件
{
// "editor.fontFamily": "'monaco','Roboto Mono'",
// "terminal.integrated.fontFamily": "monaco",
"editor.fontSize": 16,
"editor.fontWeight": "400",
"editor.fontLigatures": true,
"workbench.colorTheme": "Monokai",
"editor.lineHeight": 24,
"workbench.editorAssociations": {
"*.ipynb": "jupyter-notebook"
},
"jupyter.alwaysTrustNotebooks": true,
"terminal.integrated.fontSize": 13,
"eslint.format.enable": true,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"html.format.unformatted": "",
"eslint.alwaysShowStatus": true,
"eslint.codeAction.showDocumentation": {
"enable": true
},
"eslint.validate": [
"javascript",
{
"language": "vue",
"autoFix": true
},
"html",
"vue"
],
"javascript.updateImportsOnFileMove.enabled": "always",
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[vue]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"terminal.integrated.inheritEnv": false,
"liveServer.settings.donotShowInfoMsg": true,
"liveServer.settings.donotVerifyTags": true,
"fileheader.configObj": {
"Author": "xingwujie",
"createFileTime": true,
"language": {
"languagetest": {
"head": "/$$",
"middle": " $ @",
"end": " $/"
}
},
"autoAdd": true,
"autoAddLine": 100,
"autoAlready": true,
"annotationStr": {
"head": "/*",
"middle": " * @",
"end": " */",
"use": false
},
"headInsertLine": {
"php": 2,
"sh": 2
},
"beforeAnnotation": {
"文件后缀": "该文件后缀的头部注释之前添加某些内容"
},
"afterAnnotation": {
"文件后缀": "该文件后缀的头部注释之后添加某些内容"
},
"specialOptions": {
"特殊字段": "自定义比如LastEditTime/LastEditors"
},
"switch": {
"newlineAddAnnotation": true
},
"supportAutoLanguage": [],
"prohibitAutoAdd": [
"json"
],
"folderBlacklist": [
"node_modules",
"文件夹禁止自动添加头部注释"
],
"prohibitItemAutoAdd": [
"项目的全称, 整个项目禁止自动添加头部注释, 可以使用快捷键添加"
],
"moveCursor": true,
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"atSymbol": [
"@",
"@"
],
"atSymbolObj": {
"文件后缀": [
"头部注释@符号",
"函数注释@符号"
]
},
"colon": [
": ",
": "
],
"colonObj": {
"文件后缀": [
"头部注释冒号",
"函数注释冒号"
]
},
"filePathColon": "路径分隔符替换",
"showErrorMessage": false,
"writeLog": false,
"wideSame": false,
"wideNum": 13,
"functionWideNum": 0,
"CheckFileChange": false,
"createHeader": true,
"useWorker": false,
"designAddHead": false,
"headDesignName": "random",
"headDesign": false,
"cursorModeInternal": false,
"openFunctionParamsCheck": true,
"functionParamsShape": "normal",
"functionBlankSpace": 0
},
"fileheader.cursorMode": {
"Author": "dingguowei",
},
"fileheader.customMade": {
"Author": "yinzisang",
"Date": "Do not edit",
"LastEditors": "yinzisang",
"LastEditTime": "Do not edit"
},
"editor.rulers": [],
}
三、安装插件 eslint 与 prettier
四、进入代码文件,写代码时如果格式不规范会有提示,写完代码ctrl + r 保存加自动修改
如果有用的话点个赞再走吧