environment
- node v16.18.1
- npm v8.19.2
- yarn v1.22.19
Create a Vite+Vue project
yarn create vue
code
<!-- App.vue -->
<template>
<div ref="codeRef"></div>
</template>
<script setup>
import { EditorView } from "@codemirror/view";
import { onMounted, ref } from "vue";
import { oneDark } from "@codemirror/theme-one-dark";
const codeRef = ref(null);
onMounted(() => {
new EditorView({
parent: codeRef.value,
extensions: [oneDark],
});
});
</script>
-
when fixed version like this:
yarn add @codemirror/view@6.9.1 @codemirror/state@6.2.0
one dark doesn’t work
-
remove and install by
yarn add @codemirror/view @codemirror/state
one dark working
-
language,autocompletion… as same as one dark