when used 'autocompletion({})' Extension, EditorState.create an error occurred

this is my code :slight_smile:


  doc: codeInfo.code,

  extensions: [





        key: 'F2',

        win: 'F2',

        run: view => self.openCustomPanel(view)



        key: 'Ctrl-d',

        win: 'Ctrl-d',

        run: view => deleteLine(view),

        preventDefault: true



        key: 'Alt-/',

        win: 'Alt-/',

        run: view => startCompletion(view),

        preventDefault: true










    EditorView.theme(customTheme, {dark: false})



Error: Unrecognized extension value in extension set ([object Object]). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.

Make sure your system is only loading one version of @codemirror/state — you sometimes need to remove your package lock and install from scratch to get npm to set up a reasonable dependency tree.

thanks marijn, I tried following your method. But that doesn’t seem to be this problem. when i remove ‘autocompletion(self.myAutoComplete)’ Extension, EditorState.create works fine. or remove others Extension,
‘autocompletion(self.myAutoComplete)’ Extension also works fine.

I don’t think that follows. If @codemirror/autocomplete is loading a different version of @codemirror/state than the rest of your system, you will see exactly this error.

aha, I tried to lower the version again, error solved. Thank you for your patience, I think I should try more, when i ask a question

@marijn terribly sorry. ’autocompletion(self.myAutoComplete)‘ extension faced with a new problem in the process of using. When entering characters in the editor,The automatic prompt panel does not respond, I guarantee that the input content exists in the options. The function is defined as follows: configuration comes from example: CodeMirror Autocompletion Exampleautocomplate

myAutoComplete() {
      return {
        override: [
          context =>{
            let word = context.matchBefore(/\w*/)
            return {
              from: word.from,
              options: [
                { label: "match", type: "keyword" },
                { label: "hello", type: "variable", info: "(World)" },
                { label: "magic", type: "text", apply: "⠁⭒*.✩.*⭒⠁", detail: "macro" }

I have another question,Is there a conflict between the autocompletion configuration in basicSetupand the configuration of the custom extension twice? filtering out the autocompletion extension in basicSetup doesn’t seem to solve my problem either.
When you see this message, I hope to get your help, thank you very much!

Loading the autocompletion extension twice is no problem. I don’t know what might be going wrong with your completion. Do others, like the one you get with @codemirror/lang-javascript, work better for you?

thank you marijn, what you said is not what I want. CompletionConfig Object is what i need. it provides great scalability.
I’ve been struggling with the way I’ve configured it and ignored my code. As said, the code has logical errors. Thanks, it’s working fine now.