鍍金池/ 問答/網(wǎng)絡安全  HTML/ vscode升級到1.19.2后,格式化出現(xiàn)問題,js函數(shù)括號前沒空格,vue文

vscode升級到1.19.2后,格式化出現(xiàn)問題,js函數(shù)括號前沒空格,vue文件的html代碼不被格式化

user setting 的配置如下:

{
  "workbench.colorTheme": "Monokai",
  "editor.matchBrackets": false,
  "workbench.iconTheme": "vscode-icons",
  "gitlens.advanced.messages": {
    "suppressCommitHasNoPreviousCommitWarning": false,
    "suppressCommitNotFoundWarning": false,
    "suppressFileNotUnderSourceControlWarning": false,
    "suppressGitVersionWarning": false,
    "suppressLineUncommittedWarning": false,
    "suppressNoRepositoryWarning": false,
    "suppressUpdateNotice": false,
    "suppressWelcomeNotice": true
  },
  "files.associations": {
    "*.vue": "vue"
  },
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    "html",
    "vue",
    {
      "language": "vue",
      "autoFix": true
    }
  ],
  "eslint.autoFixOnSave": true,
  "editor.tabSize": 2,
  "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe",
  "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
  "typescript.format.insertSpaceBeforeFunctionParenthesis": true,
  "prettier.singleQuote": true,
  "prettier.trailingComma": "none",
  "prettier.semi": false,
  "prettier.useTabs": false,
  "prettier.tabWidth": 2,
  "vetur.format.defaultFormatter.js": "prettier",
  "vetur.format.defaultFormatter.html": "js-beautify-html"
}

之前格式化一直沒問題,vscode更新之后,格式化后,javascript函數(shù)的小括號前的空格被去掉,并且vue文件template里的代碼根本不被格式化。

回答
編輯回答
落殤

使用vsc自帶的ts格式化,配置以下內容:

"vetur.format.defaultFormatter.js": "vscode-typescript"
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,

2018年4月24日 01:08
編輯回答
柒喵

本人已經(jīng)解決 https://juejin.im/post/5a9fae...

2017年6月8日 19:41
編輯回答
耍太極

樓主解決了嗎?
我這也遇到了同樣的問題,之前配置的vetur、prettier現(xiàn)在也不起作用了

2017年3月21日 12:45