Skip to content

Commit

Permalink
fix: prettier.format() 返回的是 Promise,需要 await 才能取到格式化结果
Browse files Browse the repository at this point in the history
  • Loading branch information
anjianshi authored Nov 22, 2024
1 parent 3f112f8 commit 46882d9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/plugin/WxmlFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default class implements DocumentFormattingEditProvider, DocumentRangeFor
if (this.config.wxmlFormatter === 'prettier') {
const prettier: PrettierType = requireLocalPkg(doc.uri.fsPath, 'prettier')
const prettierOptions = await resolveOptions(prettier)
content = prettier.format(code, { ...this.config.prettier, ...prettierOptions })
content = await prettier.format(code, { ...this.config.prettier, ...prettierOptions })
} else if (this.config.wxmlFormatter === 'jsBeautifyHtml') {
const jsb_html = require('js-beautify').html
let conf = this.config.jsBeautifyHtml;
Expand Down

0 comments on commit 46882d9

Please sign in to comment.