vs code中添加Vue格式化时不支持格式化html部分的支持

1.首先安装vetur
2.然后配置vscode的设置项,如下

{
    "explorer.confirmDragAndDrop": true, // 当拖动一个文件或者文件夹到另一个文件夹时,是否启动提示
    "editor.fontSize": 14, // 设置编辑器字体大小
    "editor.tabSize": 2, // 设置编辑器一个tab占多少个空格
    "editor.renderWhitespace": "all", // 空格是否显示
    "editor.lineHeight": 20, // 编辑器行高
    "javascript.implicitProjectConfig.experimentalDecorators": true, // 使用vscode编辑器出现,experimentaldecorators报错
    "window.zoomLevel": 0, // Adjust the zoom level of the window
    "editor.detectIndentation": false, // When opening a file, `editor.tabSize` and `editor.insertSpaces` will be detected based on the file contents.
    "typescript.updateImportsOnFileMove.enabled": "always", // Enable/disable automatic updating of import paths when you rename or move a file in VS Code. Possible values are: 'prompt' on each rename, 'always' update paths automatically, and 'never' rename paths and don't prompt me. Requires TypeScript >= 2.9
    "files.autoSave": "onFocusChange",
    "vetur.format.defaultFormatter": {
      "html": "prettier",
      "css": "prettier",
      "postcss": "prettier",
      "scss": "prettier",
      "less": "prettier",
      "js": "prettier",
      "ts": "prettier",
      "stylus": "stylus-supremacy"
  }
}

提示不存在配置别管,照配

如果要配置格式化选项,那么需要新增一个文件
.prettierrc
具体格式规则在下面配置就行了,如下

{
  "semi": false,
  "overrides": [
    {
      "files": "*.test.js",
      "options": {
        "semi": true
      }
    }
  ]
}
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • feisky云计算、虚拟化与Linux技术笔记posts - 1014, comments - 298, trac...
    不排版阅读 4,398评论 0 5
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 136,746评论 19 139
  • Spring Boot 参考指南 介绍 转载自:https://www.gitbook.com/book/qbgb...
    毛宇鹏阅读 47,295评论 6 342
  • ORA-00001: 违反唯一约束条件 (.) 错误说明:当在唯一索引所对应的列上键入重复值时,会触发此异常。 O...
    我想起个好名字阅读 6,062评论 0 9
  • 疯狂的思念,你有否经历过? 我最近正在经历,一轮又一轮,对象时常改变,思念不断加剧。 让人思念的,确实是那些许久没...
    职场清醒徐老师阅读 366评论 0 0

友情链接更多精彩内容