javascript - Prettier vscode json文件缩进间距问题
问题描述
在保存任何文件时,它会缩进两个制表符,即开头的 4 个空格。prettier
哪个规则与设置冲突.vscode
?
编辑器配置设置如下:
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
max_line_length = 120
尝试缩进 2 个空格,这仅发生
在 json 文件和其他脚本中。
vscode 设置
{
"[javascript]": {
"editor.formatOnSave": false
},
"eslint.alwaysShowStatus": true,
"files.autoSave": "onFocusChange",
"prettier.proseWrap": "preserve",
"emmet.includeLanguages": {
"javascript": "javascriptreact",
"vue-html": "html",
"plaintext": "jade",
"edge": "html"
},
"emmet.syntaxProfiles": {
"javascript": "jsx"
},
"emmet.triggerExpansionOnTab": true,
"emmet.showSuggestionsAsSnippets": true,
"files.associations": {
"*.js": "javascriptreact"
},
"editor.fontSize": 14,
"git.enableSmartCommit": true,
"git.confirmSync": false,
"search.exclude": {
"**/__snapshots__/**": true,
"**/.bin": true,
"**/.git": true,
"**/.next": true,
"**/bower_components": true,
"**/coverage/**": true,
"**/node_modules": false,
"**/node_modules/**": true,
"**/report/**": true,
"**/tmp": true
},
"javascript.updateImportsOnFileMove.enabled": "always",
"explorer.confirmDragAndDrop": false,
"explorer.confirmDelete": false,
"workbench.editor.enablePreviewFromQuickOpen": false,
"files.exclude": {
".next": true,
"*.log": true,
"**/__pycache__": true,
"**/o": true,
"dist": true,
"geckodriver.log": true,
"node_modules/": true,
"package-lock.json": true,
"yarn.lock": true
},
"window.zoomLevel": 1,
"editor.find.globalFindClipboard": true,
"editor.fontLigatures": true,
"jshint.enable": false,
"editor.formatOnType": true,
"team.showWelcomeMessage": false,
"git.autofetch": true,
"workbench.startupEditor": "newUntitledFile",
"editor.codeActionsOnSave": {
// For ESLint
"source.fixAll.eslint": true,
// For TSLint
"source.fixAll.tslint": true,
// For Stylelint
"source.fixAll.stylelint": true
},
"launch": {},
"workbench.colorCustomizations": {},
"sync.forceUpload": true,
"sync.forceDownload": true,
"sync.autoDownload": true,
"vetur.format.defaultFormatter.html": "js-beautify-html",
"intelephense.diagnostics.undefinedTypes": false,
"workbench.editorAssociations": [],
"diffEditor.codeLens": true,
"editor.formatOnSave": true,
"team.showFarewellMessage": false,
"eslint.validate": [],
"vetur.validation.template": false,
"prettier.enable": true,
"editor.formatOnPaste": true,
"editor.tabSize": 2,
"files.insertFinalNewline": true,
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2
},
"editor.tokenColorCustomizations": null
}
解决方案
这是由于一个扩展名:'lonefy.vscode-js-css-html-formatter'。
推荐阅读
- ios - 更改可操作的推送通知按钮颜色和字体
- java - Java 9 是否包含内置 JSON?
- c# - 读取进程内存不起作用给出错误尝试读取或写入受保护的内存
- android - 如何在一个应用程序(驱动程序和客户应用程序)中为 2 个应用程序(驱动程序应用程序和客户应用程序)制作 MyFirebaseMessaging?
- javascript - 得到从 ` 推导出的区域的值
` .svg 的信息 - html - 垂直居中问题
- go - 从后台 go 进程读取标准输入会导致 EOF 错误
- jquery - @Ajax.ActionLink 有效,但 $.ajax 无效
- php - 导航子菜单项未出现在 iframe 中
- laravel - Laravel 5.5 - 如何根据 `id` 值创建`negative_id` 列值?