Open richardjharris opened 1 year ago
The possible cause at the moment is because the implementation is to register the extension by the method described in the address below.
https://codemirror.net/examples/config/
StateEffect.reconfigure.of(extensions)
With this method, it seems that some states and other values cannot be reflected, so there may be some ingenuity.
https://discuss.codemirror.net/t/how-update-extensions-after-creating/4064
Although it is palliative, please try to reload the extension by executing the forceReconfigure()
function that has been available since 1.19.
Hi, how can i trigger showing autocomplete after every keypress, not only after ctrl + space?
According to the CodeMirror specifications, there are patterns that do not work unless the extension is registered at initialization, and patterns that work even if the extension is registered later with the reconfigure instruction, so it is difficult to isolate the problem.
In vue-codemirror6, I think that this problem occurred because it was processed with reconfigure at once.
As a temporary measure, I prepared the forceReconfigure()
method. This is the process of canceling all registered extensions and then registering them.
It's a rough implementation, but please try to execute the forceReconfigure
function on the component when the extensions are updated as shown below.
<script setup>
import { watch } from 'vue';
import CodeMirror from 'vue-codemirror6";
const editor = ref();
// some function
watch(
() => extnetions.value,
() => editor.value?.forceReconfigure());
);
</script>
<template>
<codemirror v-model="value" ref="editor" />
</template>
If you visit https://codemirror.net/try/ and type this in
... autocompletion automatically triggers when # is typed.
I tried to create the same code using vue-codemirror6 and the autocompletion only works when Ctrl+Space is pressed, e.g.
https://playcode.io/1085925