vscode 对js文件不格式化的修正方案 settings.json
修正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的更多相关文章
- vscode中js文件失去高亮/没有智能提示
vscode中js文件失去高亮/没有智能提示 两步: 第一步:基本的语法高亮提示,需要将vetur删掉,然后把vscode的历史记录缓存删掉,重启vscode. 第二步:js的智能提示,使用插件typ ...
- vscode中js文件使用typescript语法报错,如何解决
原因:由于vcode自身的语法检查有些问题 解决办法:在设置里面加上 "javascript.validate.enable": false 禁用默认的 js 验证 总结: 由于v ...
- JavaScript的js文件压缩和格式化工具
JavaScriptcompressor.com这个网站可是大名鼎鼎啊.以前在找到过压缩 Javascript 代码的程序,一直在用,感觉效果不错.域名是: http://javascriptcomp ...
- 在SharePoint解决方案中使用JavaScript (1) – 引用.js文件
本文是系列文章的第一篇. 在SharePoint解决方案中使用JavaScript (0) 作为在SharePoint应用程序中使用JavaScript的第一步,就是要知道如何将一个写好的.js文件, ...
- angular项目引用第三方公共js文件
由于项目需要,领导要求在正在开发的angular项目中,引入公共js,以便进行统计计算. 于是便各种找度娘,网上有好多引用jquery插件的例子,于是便按照步骤对自身项目进行了改造,先记录一下: st ...
- 解决VSCode中使用vetur插件格式化vue文件时,js代码会自动加上冒号和分号
解决VSCode中使用vetur插件格式化vue文件时,js代码会自动加上冒号和分号 在设置中把"vetur.format.defaultFormatter.js": " ...
- vscode对Vue文件的html部分格式化失效问题解决办法
使用vscode编辑vue文件时发现突然格式化代码不会对<template> </template>之间的html生效了,解决办法很简单 文件 --> 首选项 ---&g ...
- 安装typescript环境并开启VSCode自动监视编译ts文件为js文件
一.前言 小编最近开始学习typescript,懂得人都知道,typescript是vue3的基础伴生,配合更加默契.就像vue2和js一样!typescript不像js那样浏览器直接可以解读,需要我 ...
- vscode 终端中运行执行js文件
问题汇总 1.在vscode中执行node -v没有反应或者执行js文件出现下图错误 解决办法: 1.先关闭vscode,找到vscode的执行文件,在兼容性中勾上以管理员身份运行此程序,该问题win ...
- vscode中外部引入js文件以及里面相应的方法
随便写一个js文件,定义一个方法名,并且在组件中进行引用就算成功 ###~js function shuchu(){ console.log(1) } export { shuchu }; ...
随机推荐
- C/C++ 简单特征码匹配
特征码定位查杀 简单提取一段特征码字段. 代码编写. #include <stdio.h> #include <Windows.h> #define FileLEN 20 // ...
- Python 实现专属字典生成器
编写一个密码生成工具,这里我们使用弱密码与个性化数组组合形成一个定制字典,例如收集用户的姓名,昵称,QQ号手机号等资源,然后通过Python对搜集到的数据与弱密码进行结合,从而定制出属于某个人的专属密 ...
- git常用命令(企业级)
一: 常用git命令 # 初始化,将已有的文件初始化为git仓库 git init # 查询文件状态[绿色暂存区,红色表示工作区更改了,没有提交到暂存区] git status git status ...
- 深入浅出Java多线程(八):volatile
引言 大家好,我是你们的老伙计秀才!今天带来的是[深入浅出Java多线程]系列的第八篇内容:volatile.大家觉得有用请点赞,喜欢请关注!秀才在此谢过大家了!!! 在当今的软件开发领域,多线程编程 ...
- electron 安装不同的版本的方法
1.官网:http://www.electronjs.org/ 2.思考,既然是npm 安装,那么肯定也在 npm中央仓库有,那么去中央仓库看下: npm i -D electron@11.0.4
- Delphi判断一个字符串在另一个字符串中出现的次数 7个方法的效率对比。
unit Unit14; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, Syste ...
- NC16466 [NOIP2015]信息传递
题目链接 题目 题目描述 有 n 个同学(编号为 1 到 n)正在玩一个信息传递的游戏.在游戏里每人都有一个固定的信息传递对象,其中,编号为 i 的同学的信息传递对象是编号为Ti的同学. 游戏开始时, ...
- NC16850 [NOI1998]免费馅饼
题目链接 题目 题目描述 SERKOI最新推出了一种叫做"免费馅饼"的游戏:游戏在一个舞台上进行.舞台的宽度为W格,天幕的高度为H格,游戏者占一格.开始时游戏者站在舞台的正中央,手 ...
- Slot 的含义
Slot 解释 1)slot就是槽的意思,是一个资源单位,只有给task分配了一个slot之后,这个task才可以运行.slot分两种,map slot沪蓉reduce slot.另外,slot是一个 ...
- python中两个不同shape的数组间运算规则
1 前言 声明:本博客讨论的数组间运算是指四则运算,如:a+b.a-b.a*b.a/b,不包括 a.dot(b) 等运算,由于 numpy 和 tensorflow 中都遵循相同的规则,本博客以 nu ...