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

this is my code :slight_smile:

EditorState.create({

  doc: codeInfo.code,

  extensions: [

    ...basicSetup,

    keymap.of([

      indentWithTab,

      {

        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

      }

    ]),

    language.of(java()),

    tabSize.of(EditorState.tabSize.of(4)),

    linter(self.buildScriptLintFunction),

    lintGutter(),

    lineNumbers(),

    foldGutter(customFoldGutterConfig),

    autocompletion(self.myAutoComplete),

    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.