Skip to content

Commit d9a70e0

Browse files
committed
chore(prettier): migrate to async formatting and updated plugin imports
1 parent 6e29911 commit d9a70e0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/monaco/Monaco.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import { initMonaco } from './env'
1414
import { getOrCreateModel } from './utils'
1515
import { Store } from '../store'
1616
import type { PreviewMode } from '../editor/types'
17-
import parserBabel from 'prettier/parser-babel'
18-
import parserHtml from 'prettier/parser-html'
19-
import parserPostcss from 'prettier/parser-postcss'
17+
import parserBabel from 'prettier/plugins/babel'
18+
import parserHtml from 'prettier/plugins/html'
19+
import parserPostcss from 'prettier/plugins/postcss'
2020
import prettier from 'prettier/standalone'
2121
import { registerHighlighter } from './highlight'
2222
@@ -145,7 +145,7 @@ onMounted(() => {
145145
emit('change', editorInstance.getValue())
146146
})
147147
148-
editorInstance.onDidBlurEditorWidget(() => {
148+
editorInstance.onDidBlurEditorWidget(async () => {
149149
const parser = {
150150
vue: 'html',
151151
html: 'html',
@@ -165,7 +165,7 @@ onMounted(() => {
165165
166166
let code = editorInstance.getValue()
167167
try {
168-
code = prettier.format(code, options)
168+
code = await prettier.format(code, options)
169169
} catch (err) {}
170170
171171
if (code !== props.value) {

0 commit comments

Comments
 (0)