修正1

 "javascript.format.enable": true, // 这里false 改true

修正2 注释掉这个地方

 // "[javascript]": {
// "editor.defaultFormatter": "dbaeumer.vscode-eslint"
// },

20211102 setting.json

{
"pasteImage.path": "${currentFileNameWithoutExt}_Images/",
"update.mode": "manual",
"extensions.autoUpdate": false,
"extensions.autoCheckUpdates": false,
"editor.formatOnSave": true, // 这个保存时候进行格式化
"editor.codeActionsOnSave": {
// 保存时候 eslint修复
"source.fixAll.eslint": true
},
"eslint.alwaysShowStatus": true,
"editor.fontSize": 22,
"editor.fontFamily": "Consolas, 'Courier New', monospace",
"editor.fontLigatures": false,
"editor.fontWeight": "400",
"editor.lineHeight": 28,
"editor.letterSpacing": 0,
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.detectIndentation": true,
"editor.wordWrap": "off",
"editor.renderLineHighlight": "gutter",
"editor.roundedSelection": true,
"editor.renderControlCharacters": true,
"editor.renderIndentGuides": true,
"editor.dragAndDrop": false,
"editor.minimap.enabled": false,
"editor.minimap.showSlider": "mouseover",
"editor.minimap.renderCharacters": true,
"editor.minimap.maxColumn": 200,
"editor.quickSuggestions": {
"strings": true
},
"editor.suggestSelection": "first",
"window.titleBarStyle": "native",
"window.menuBarVisibility": "visible",
"window.title": "${rootName} - ${dirty}${activeEditorLong}",
"workbench.colorTheme": "Spacegray Eighties Dark",
"workbench.iconTheme": "material-icon-theme",
"workbench.startupEditor": "welcomePage",
"workbench.activityBar.visible": true,
"workbench.editor.enablePreview": true,
"workbench.editor.tabSizing": "fit",
"workbench.editor.wrapTabs": false,
"workbench.editor.decorations.colors": true,
"workbench.editor.decorations.badges": true,
"workbench.tree.renderIndentGuides": "none",
"workbench.colorCustomizations": {
// "statusBar.background": "#333333",
// "statusBar.foreground": "#adadad",
"terminal.background": "#000000",
"terminal.foreground": "#FFFFFF"
},
"breadcrumbs.enabled": true,
"breadcrumbs.symbolPath": "off",
"explorer.openEditors.visible": 0,
"explorer.compactFolders": false,
"files.encoding": "utf8",
"files.eol": "\r\n",
"files.hotExit": "onExit",
"files.autoSave": "off",
"emmet.includeLanguages": {
"javascript": "javascriptreact"
},
//javascript
// "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
"js/ts.implicitProjectConfig.experimentalDecorators": true,
//git
"git.path": "D:\\Git\\bin\\git.exe",
"git.enableSmartCommit": false,
//terminal
//"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\cmd.exe",
//"terminal.integrated.shell.windows": "D:\\Git\\git-bash.exe",
"terminal.explorerKind": "integrated",
//eslint
"eslint.format.enable": false,
"eslint.validate": [
"javascript",
"javascriptreact",
"vue",
"typescript",
"typescriptreact"
],
//bookmarks
// "bookmarks.saveBookmarksInProject": true,
"javascript.format.insertSpaceBeforeFunctionParenthesis": true, // 让函数名和后面的括号之间加个空格
"javascript.format.insertSpaceAfterCommaDelimiter": true, // 逗号后面有空格
"javascript.format.insertSpaceBeforeAndAfterBinaryOperators": true, // 运算符前后有空格
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true, // 大括号前面插空格
"javascript.format.insertSpaceAfterKeywordsInControlFlowStatements": true, // 关键字后面加空格
"javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": true, // 匿名函数后面加空格
"vetur.format.options.tabSize": 2, // 每个缩进级别的空格数,由所有格式化程序继承
"vetur.format.scriptInitialIndent": false, // js部分是否有初始缩进
//vetur
"vetur.format.defaultFormatter.js": "vscode-typescript",
"vetur.format.defaultFormatter.html": "js-beautify-html",
"vetur.format.defaultFormatterOptions": {
"js-beautify-html": {
// - auto: 仅在超出行长度时才对属性进行换行
// - force: 对除第一个属性外的其他每个属性进行换行
// - force-aligned: 对除第一个属性外的其他每个属性进行换行,并保持对齐
// - force-expand-multiline: 对每个属性进行换行
// - aligned-multiple: 当超出折行长度时,将属性进行垂直对齐
"wrap_attributes": "force-aligned", // 属性折行对齐方式
"wrap_line_length": 120, // 设置一行多少字符换行
"semi": false, // 是否在每行末尾添加分号
"singleQuote": true, // 使用单引号
"end_with_newline": false
}
},
//liveServer
"liveServer.settings.donotVerifyTags": true,
//alias-skip
"alias-skip.mappings": {
"@": "/src",
"_c": "/src/components"
},
// "[vue]": {
// "editor.defaultFormatter": "esbenp.prettier-vscode"
// },
"[markdown]": {
"editor.minimap.enabled": true,
"editor.wordWrap": "on",
"editor.quickSuggestions": false,
"editor.formatOnSave": false
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
// "[javascript]": {
// "editor.defaultFormatter": "dbaeumer.vscode-eslint"
// },
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"scf.python3.path": "",
"scf.python2.path": "",
"tabnine.experimentalAutoImports": true,
"javascript.format.enable": true, // 20211102bug 发现js格式化不起错用,这个是false 并且[javascript] 需要注释掉
"javascript.format.insertSpaceAfterConstructor": false,
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": false,
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false,
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false,
"javascript.format.insertSpaceAfterSemicolonInForStatements": true,
"javascript.format.placeOpenBraceOnNewLineForControlBlocks": false,
"javascript.format.placeOpenBraceOnNewLineForFunctions": false,
"liveServer.settings.donotShowInfoMsg": true,
"[typescriptreact]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"vue-helper.alias": {
"_c": "src/components/",
"@": "src/"
},
"commentTranslate.source": "Baidu",
"commentTranslate.targetLanguage": "zh-CN",
"easy-translator.dictionary": [
"YouDao",
"Bing",
"Google",
"Linguee"
],
"vue-helper.componentPrefix": {
"alias": "@",
"path": "src"
},
"vue-helper.componentPath": [
"./*",
"./components/*"
],
"php.validate.executablePath": "D:/phpstudy_pro/Extensions/php/php5.6.9nts/php.exe",
"[typescript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"javascript.updateImportsOnFileMove.enabled": "always",
"[vue]": {
"editor.defaultFormatter": "octref.vetur"
},
"vetur.validation.template": false,
"git.confirmSync": false,
"intelephense.diagnostics.languageConstraints": false,
"files.exclude": {
"**/.git": false
},
"files.associations": {
"*.vue": "vue"
}
}

vscode 对js文件不格式化的修正方案 settings.json的更多相关文章

  1. vscode中js文件失去高亮/没有智能提示

    vscode中js文件失去高亮/没有智能提示 两步: 第一步:基本的语法高亮提示,需要将vetur删掉,然后把vscode的历史记录缓存删掉,重启vscode. 第二步:js的智能提示,使用插件typ ...

  2. vscode中js文件使用typescript语法报错,如何解决

    原因:由于vcode自身的语法检查有些问题 解决办法:在设置里面加上 "javascript.validate.enable": false 禁用默认的 js 验证 总结: 由于v ...

  3. JavaScript的js文件压缩和格式化工具

    JavaScriptcompressor.com这个网站可是大名鼎鼎啊.以前在找到过压缩 Javascript 代码的程序,一直在用,感觉效果不错.域名是: http://javascriptcomp ...

  4. 在SharePoint解决方案中使用JavaScript (1) – 引用.js文件

    本文是系列文章的第一篇. 在SharePoint解决方案中使用JavaScript (0) 作为在SharePoint应用程序中使用JavaScript的第一步,就是要知道如何将一个写好的.js文件, ...

  5. angular项目引用第三方公共js文件

    由于项目需要,领导要求在正在开发的angular项目中,引入公共js,以便进行统计计算. 于是便各种找度娘,网上有好多引用jquery插件的例子,于是便按照步骤对自身项目进行了改造,先记录一下: st ...

  6. 解决VSCode中使用vetur插件格式化vue文件时,js代码会自动加上冒号和分号

    解决VSCode中使用vetur插件格式化vue文件时,js代码会自动加上冒号和分号 在设置中把"vetur.format.defaultFormatter.js": " ...

  7. vscode对Vue文件的html部分格式化失效问题解决办法

    使用vscode编辑vue文件时发现突然格式化代码不会对<template> </template>之间的html生效了,解决办法很简单 文件 --> 首选项 ---&g ...

  8. 安装typescript环境并开启VSCode自动监视编译ts文件为js文件

    一.前言 小编最近开始学习typescript,懂得人都知道,typescript是vue3的基础伴生,配合更加默契.就像vue2和js一样!typescript不像js那样浏览器直接可以解读,需要我 ...

  9. vscode 终端中运行执行js文件

    问题汇总 1.在vscode中执行node -v没有反应或者执行js文件出现下图错误 解决办法: 1.先关闭vscode,找到vscode的执行文件,在兼容性中勾上以管理员身份运行此程序,该问题win ...

  10. vscode中外部引入js文件以及里面相应的方法

    随便写一个js文件,定义一个方法名,并且在组件中进行引用就算成功 ###~js function shuchu(){     console.log(1) } export { shuchu };   ...

随机推荐

  1. HTTP请求头引发的注入问题 (SQL注入)

    关于请求头中注入问题的演示,这里我写了一些测试案例,用来测试请求头中存在的问题.我们常见的会发生注入的点有 Referer.X-Forwarded-For.Cookie.X-Real-IP.Accep ...

  2. 求助:Docker怎么连接mongoDB?

    首先 在playwithDocker中通过docker pull mongo引入mongo 然后创建容器 docker run -it --name mymongo -p 27017:27017 -v ...

  3. OpenGL的深度缓冲

      如果我们想要在三维空间里画两个正方形:一个红色的,一个绿色的,而且从人眼的观察角度看,绿色正方形在红色正方形的后面,最后看上去应该是这样的: 要点在于,从观察者的角度看,绿色正方形在红色正方形的后 ...

  4. (C语言)每日代码||2023.12.25||函数传参,传入数组时传递的是数组首元素地址

    向函数传入某数组时,可以在函数内修改该数组的元素. #include <stdio.h> void test(char* p, char arr[]) { *p = 'h';//能改变 * ...

  5. Java - CodeForces - 1230A

    题目: Dawid有了 4 包糖果.第 i 包里面有 Ai 个糖果. Dawid想把这四包糖果送给两个朋友,能否让两个朋友收到相同数量的糖果?注意,不能拆开任何一包糖,不能把糖果留给自己或扔掉,四包糖 ...

  6. 域名解析迟迟不生效,刷新本地DNS的方法

    ipconfig /flushdns 刷新后,再ping  发生域名解析 的指向就对了.!

  7. Unix\Linux 执行 shell 报错:“$'\r': 未找到命令” 的解决办法

    原因 原因是因为 shell 脚本是在 Windows 编写导致的换行问题,具体原因是 Windows 的换行符号为 CRLF(\r\n),而 Unix\Linux 为 LF(\n),Macintos ...

  8. MySQL 8.0.25从节点自动故障转移测试

    从MySQL 8.0.23开始,复制结构中,增加了从节点自动故障转移功能.测试一下起功能: 用dbdeployer快速安装测试环境,我这边安装的是:dbdeployer1.8.5    -- 安装脚本 ...

  9. (微服务)服务治理:熔断器介绍以及hystrix-go的使用

    一.什么是熔断器 要理解熔断器,可以先看看电路中使用的保险丝. 保险丝(fuse)也被称为电流保险丝,IEC127 标准将它定义为"熔断体(fuse-link)".保险丝是一种保证 ...

  10. 2021-07-01 原生js获取文件数据

    原理 手动用js创建一个type为file的DOM元素. 在读取到数据后,清空手动创建的DOM元素.返回得到的Promise类型的文件数据files. const getFilesPromise = ...