Skip to content

Commit e1e80b9

Browse files
committed
fix: use worker
1 parent f765d54 commit e1e80b9

21 files changed

+1104
-850
lines changed

index-dist.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@
1717
<script type="module">
1818
import { createApp } from 'vue'
1919
import { Repl } from './dist/vue-repl'
20+
import Monaco from './dist/vue-repl-monaco-editor'
2021
import './dist/style.css'
21-
createApp(Repl).mount('#app')
22+
createApp(Repl, {
23+
editor: Monaco
24+
}).mount('#app')
2225
</script>
2326
</head>
2427
<body>

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"@vue/shared": "^3.2.37",
5151
"codemirror": "^5.62.3",
5252
"hash-sum": "^2.0.0",
53+
"monaco-editor-core": "^0.33.0",
5354
"rimraf": "^3.0.2",
5455
"sucrase": "^3.20.1",
5556
"typescript": "^4.7.3",

pnpm-lock.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Repl.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ provide('clear-console', toRef(props, 'clearConsole'))
4747
<template #right>
4848
<Output
4949
:showCompileOutput="props.showCompileOutput"
50-
:editor-component="editor"
5150
:ssr="!!props.ssr"
5251
/>
5352
</template>

src/monaco/Monaco.vue

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<script lang="ts">
2-
import { setupMonacoEnv } from './utils';
2+
import { setupMonacoEnv } from './env';
33
setupMonacoEnv();
4+
import './monaco.contribution'
45
</script>
56
<script lang="ts" setup>
67
import { onMounted, onBeforeUnmount, ref, shallowRef, nextTick, watchEffect } from 'vue';
78
import { loadGrammars } from './grammars';
8-
import * as monaco from 'monaco-editor';
9-
import { setupThemePromise } from './utils';
10-
import { setupLs, getOrCreateModel, setupValidate } from './ls';
9+
import * as monaco from 'monaco-editor-core';
10+
import { setupThemePromise, getOrCreateModel } from './utils';
11+
// import { setupLs, setupValidate } from './ls';
1112
1213
const props = withDefaults(defineProps<{
1314
value?: string
@@ -35,7 +36,9 @@ const currentModel = shallowRef<monaco.editor.ITextModel>(
3536
)
3637
)
3738
38-
const documentModelMap = shallowRef(new Map([[currentModel.value.uri.fsPath, currentModel.value]]))
39+
// const documentModelMap = shallowRef(new Map([[
40+
// currentModel.value.uri.fsPath, currentModel.value
41+
// ]]))
3942
4043
watchEffect(() => {
4144
if (currentModel.value.getValue() !== props.value) {
@@ -63,11 +66,11 @@ onMounted(async () => {
6366
},
6467
inlineSuggest: {
6568
enabled: false,
66-
},
69+
}
6770
});
6871
editor.value = editorInstance
6972
70-
const ls = await setupLs(editorInstance, documentModelMap)
73+
// const ls = await setupLs(editorInstance, documentModelMap)
7174
7275
await loadGrammars(editorInstance);
7376
@@ -79,7 +82,9 @@ onMounted(async () => {
7982
emits('change', editorInstance.getValue());
8083
});
8184
82-
setupValidate(editorInstance, ls);
85+
86+
87+
// setupValidate(editorInstance, ls);
8388
});
8489
8590
onBeforeUnmount(() => {

0 commit comments

Comments
 (0)