新增中文补全
Some checks failed
Deploy / deploy (push) Has been cancelled

This commit is contained in:
2026-01-06 21:43:41 +08:00
parent 5a02b8269c
commit 3480b485d8
5 changed files with 692 additions and 8 deletions

View File

@@ -3,10 +3,13 @@ import { cpp } from "@codemirror/lang-cpp"
import { python } from "@codemirror/lang-python"
import { EditorView } from "@codemirror/view"
import { Codemirror } from "vue-codemirror"
import type { Extension } from "@codemirror/state"
import { autocompletion } from "@codemirror/autocomplete"
import { LANGUAGE } from "utils/types"
import { oneDark } from "../themes/oneDark"
import { smoothy } from "../themes/smoothy"
import { enhanceCompletion } from "shared/extensions/autocompletion"
interface Props {
language?: LANGUAGE
fontSize?: number
@@ -36,13 +39,16 @@ const styleTheme = EditorView.baseTheme({
},
})
const lang = computed((): Extension => {
const langExtension = computed(() => {
return ["Python2", "Python3"].includes(props.language) ? python() : cpp()
})
const extensions = computed(() => [
styleTheme,
lang.value,
langExtension.value,
autocompletion({
override: [enhanceCompletion(props.language)],
}),
isDark.value ? oneDark : smoothy,
])
</script>