feat: codemirror linting system

This commit is contained in:
Andrew Bastin
2021-09-01 16:41:14 +05:30
committed by liyasthomas
parent 10a11d6725
commit 071761a61e
4 changed files with 64 additions and 9 deletions

View File

@@ -7,13 +7,20 @@ import "codemirror/mode/javascript/javascript"
import { ref, watch } from "@nuxtjs/composition-api"
import { useCodemirror } from "~/helpers/editor/codemirror"
import { LinterDefinition } from "~/helpers/editor/linting/linter"
const props = defineProps<{
value: string
mode: string
placeholder: string
wrap: boolean
}>()
const props = withDefaults(
defineProps<{
value: string
mode: string
placeholder: string
wrap: boolean
linter: LinterDefinition | null
}>(),
{
linter: null as any,
}
)
const emit = defineEmits<{
(e: "input", value: string): void
@@ -30,7 +37,10 @@ watch(value, (val) => emit("input", val))
const editor = ref<any | null>(null)
useCodemirror(editor, value, {
mode: props.mode,
extendedEditorConfig: {
mode: props.mode,
},
linter: props.linter,
})
</script>