工具版本:微信开发者工具 Stable 1.03.2009140
操作系统:macOS Catalina 10.15.6
保存文件自动格式化时提示:扩展 "Prettier - Code formatter" 无法格式化 "app.js"
编辑器配置:
{
"editor.formatOnSave": true,
"editor.stablePeek": true,
"editor.tabCompletion": "on",
"editor.tabSize": 4,
"editor.wordWrapColumn": 120,
"editor.minimap.enabled": true,
"explorer.openEditors.visible": 0,
"search.exclude": {
"**/dist": true,
"**/miniprogram_npm": true
},
"files.watcherExclude": {
"**/dist/**": true,
"**/miniprogram_npm/**": true
},
"files.associations": {
"*.cjson": "jsonc",
"*.wxs": "javascript",
"*.wxss": "css"
},
"[wxml]": {
"editor.defaultFormatter": "qiu8310.minapp-vscode"
},
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"minapp-vscode.wxmlFormatter": "prettyHtml",
"minapp-vscode.formatMaxLineCharacters": 120,
"minapp-vscode.disableAutoConfig": true,
"minapp-vscode.showSuggestionOnEnter": true,
"minapp-vscode.prettier": {
"printWidth": 120,
"semi": false,
"singleQuote": true,
"trailingComma": "none"
},
"minapp-vscode.prettyHtml": {
"printWidth": 120,
"usePrettier": false,
"sortAttributes": true
},
"prettier.printWidth": 120,
"prettier.singleQuote": true,
"prettier.semi": false,
"prettier.trailingComma": "none",
"less.compile": {
"outExt": ".wxss"
}
}
自定义扩展:
确实安装了Prettier+就可以了
截图看下面板『输出』里,这个插件、插件宿主进程的日志记录呢
[2020-09-17 21:23:54.385] [exthost] [info] extension host started
[2020-09-17 21:23:54.537] [exthost] [info] ExtensionService#_doActivateExtension vscode.typescript-language-features {"startup":false,"extensionId":{"value":"vscode.typescript-language-features","_lower":"vscode.typescript-language-features"},"activationEvent":"onLanguage:javascript"}
[2020-09-17 21:23:54.587] [exthost] [info] ExtensionService#_doActivateExtension wechat.miniprogram.wx-snippets {"startup":false,"extensionId":{"value":"wechat.miniprogram.wx-snippets","_lower":"wechat.miniprogram.wx-snippets"},"activationEvent":"onLanguage:javascript"}
[2020-09-17 21:23:54.589] [exthost] [info] ExtensionService#_doActivateExtension christian-kohler.path-intellisense {"startup":true,"extensionId":{"value":"christian-kohler.path-intellisense","_lower":"christian-kohler.path-intellisense"},"activationEvent":"*"}
[2020-09-17 21:23:54.616] [exthost] [info] ExtensionService#_doActivateExtension CoenraadS.bracket-pair-colorizer-2 {"startup":true,"extensionId":{"value":"CoenraadS.bracket-pair-colorizer-2","_lower":"coenraads.bracket-pair-colorizer-2"},"activationEvent":"*"}
[2020-09-17 21:23:54.647] [exthost] [info] ExtensionService#_doActivateExtension wechat.miniprogram.emmet-wxml {"startup":true,"extensionId":{"value":"wechat.miniprogram.emmet-wxml","_lower":"wechat.miniprogram.emmet-wxml"},"activationEvent":"*"}
[2020-09-17 21:23:54.668] [exthost] [info] ExtensionService#_doActivateExtension vscode.git {"startup":true,"extensionId":{"value":"vscode.git","_lower":"vscode.git"},"activationEvent":"*"}
[2020-09-17 21:23:54.722] [exthost] [info] ExtensionService#_doActivateExtension vscode.github-authentication {"startup":true,"extensionId":{"value":"vscode.github-authentication","_lower":"vscode.github-authentication"},"activationEvent":"*"}
[2020-09-17 21:23:54.736] [exthost] [info] ExtensionService#_doActivateExtension HookyQR.beautify {"startup":true,"extensionId":{"value":"HookyQR.beautify","_lower":"hookyqr.beautify"},"activationEvent":"*"}
[2020-09-17 21:23:54.794] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict {"startup":true,"extensionId":{"value":"vscode.merge-conflict","_lower":"vscode.merge-conflict"},"activationEvent":"*"}
[2020-09-17 21:23:54.799] [exthost] [info] ExtensionService#_doActivateExtension vscode.search-result {"startup":true,"extensionId":{"value":"vscode.search-result","_lower":"vscode.search-result"},"activationEvent":"*"}
[2020-09-17 21:23:54.801] [exthost] [info] ExtensionService#_doActivateExtension oderwat.indent-rainbow {"startup":true,"extensionId":{"value":"oderwat.indent-rainbow","_lower":"oderwat.indent-rainbow"},"activationEvent":"*"}
[2020-09-17 21:23:54.806] [exthost] [info] eager extensions activated
[2020-09-17 21:24:39.915] [exthost] [info] extension host started
[2020-09-17 21:24:40.298] [exthost] [info] ExtensionService#_doActivateExtension vscode.typescript-language-features {"startup":false,"extensionId":{"value":"vscode.typescript-language-features","_lower":"vscode.typescript-language-features"},"activationEvent":"onLanguage:javascript"}
[2020-09-17 21:24:40.325] [exthost] [info] ExtensionService#_doActivateExtension wechat.miniprogram.wx-snippets {"startup":false,"extensionId":{"value":"wechat.miniprogram.wx-snippets","_lower":"wechat.miniprogram.wx-snippets"},"activationEvent":"onLanguage:javascript"}
[2020-09-17 21:24:40.326] [exthost] [info] ExtensionService#_doActivateExtension christian-kohler.path-intellisense {"startup":true,"extensionId":{"value":"christian-kohler.path-intellisense","_lower":"christian-kohler.path-intellisense"},"activationEvent":"*"}
[2020-09-17 21:24:40.336] [exthost] [info] ExtensionService#_doActivateExtension wechat.miniprogram.emmet-wxml {"startup":true,"extensionId":{"value":"wechat.miniprogram.emmet-wxml","_lower":"wechat.miniprogram.emmet-wxml"},"activationEvent":"*"}
[2020-09-17 21:24:40.354] [exthost] [info] ExtensionService#_doActivateExtension vscode.git {"startup":true,"extensionId":{"value":"vscode.git","_lower":"vscode.git"},"activationEvent":"*"}
[2020-09-17 21:24:40.393] [exthost] [info] ExtensionService#_doActivateExtension vscode.github-authentication {"startup":true,"extensionId":{"value":"vscode.github-authentication","_lower":"vscode.github-authentication"},"activationEvent":"*"}
[2020-09-17 21:24:40.403] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict {"startup":true,"extensionId":{"value":"vscode.merge-conflict","_lower":"vscode.merge-conflict"},"activationEvent":"*"}
[2020-09-17 21:24:40.406] [exthost] [info] ExtensionService#_doActivateExtension vscode.search-result {"startup":true,"extensionId":{"value":"vscode.search-result","_lower":"vscode.search-result"},"activationEvent":"*"}
[2020-09-17 21:24:40.407] [exthost] [info] ExtensionService#_doActivateExtension esbenp.prettier-vscode {"startup":true,"extensionId":{"value":"esbenp.prettier-vscode","_lower":"esbenp.prettier-vscode"},"activationEvent":"*"}
[2020-09-17 21:24:40.486] [exthost] [info] ExtensionService#_doActivateExtension oderwat.indent-rainbow {"startup":true,"extensionId":{"value":"oderwat.indent-rainbow","_lower":"oderwat.indent-rainbow"},"activationEvent":"*"}
[2020-09-17 21:24:40.489] [exthost] [info] eager extensions activated
[2020-09-17 21:23:54.799] [exthost] [info] ExtensionService#_doActivateExtension vscode.search-result {"startup":true,"extensionId":{"value":"vscode.search-result","_lower":"vscode.search-result"},"activationEvent":"*"}