Skip to content

Commit 8f49c19

Browse files
jhnnskermanx
andauthored
fix(monaco): editorOptions from monaco setup not applied (#1628)
Co-authored-by: _Kerman <kermanx@qq.com>
1 parent 7bc3c45 commit 8f49c19

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

packages/client/builtin/Monaco.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const stopWatchTypesLoading = whenever(
9797
onMounted(async () => {
9898
// Lazy load monaco, so it will be bundled in async chunk
9999
const { default: setup } = await import('../setup/monaco')
100-
const { ata, monaco } = await setup()
100+
const { ata, monaco, editorOptions } = await setup()
101101
const model = monaco.editor.createModel(code.value, lang, monaco.Uri.parse(`file:///${makeId()}.${ext}`))
102102
model.onDidChangeContent(() => code.value = model.getValue())
103103
const commonOptions = {
@@ -114,6 +114,7 @@ onMounted(async () => {
114114
fontSize: 11.5,
115115
fontFamily: 'var(--slidev-code-font-family)',
116116
scrollBeyondLastLine: false,
117+
...editorOptions,
117118
...props.editorOptions,
118119
} satisfies monaco.editor.IStandaloneEditorConstructionOptions & monaco.editor.IDiffEditorConstructionOptions
119120

packages/client/setup/monaco.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ const setup = createSingletonPromise(async () => {
9595
const { shiki, themes, shikiToMonaco } = await import('#slidev/shiki')
9696
const highlighter = await shiki
9797

98-
const setupReturn: MonacoSetupReturn = {}
98+
const editorOptions: MonacoSetupReturn['editorOptions'] & object = {}
9999
for (const setup of setups) {
100100
const result = await setup(monaco)
101-
Object.assign(setupReturn, result)
101+
Object.assign(editorOptions, result?.editorOptions)
102102
}
103103

104104
// Use Shiki to highlight Monaco
@@ -117,7 +117,7 @@ const setup = createSingletonPromise(async () => {
117117
return {
118118
monaco,
119119
ata,
120-
...setupReturn,
120+
editorOptions,
121121
}
122122
})
123123

0 commit comments

Comments
 (0)