acode / copenhagen

Free, lightweight and hackable open source code editor for the web
MIT License
498 stars 29 forks source link

What to return at addComplete function #11

Open calebeaires opened 3 years ago

calebeaires commented 3 years ago

When using addAutocomplete the editors seems to break something. I have tried to follow the documentation and even seek the Copenhagen code to find out how to use add extra AutoComplete. May yout give me a clue on how to use this feature


            const ed = new Copenhagen.Editor({ language: 'javascript' });

            // open, but do not auto-focus the editor
            ed.open(editor.value, false);

            // set a value
            ed.setValue('var message = `hello world`;');

            ed.addAutocomplete('sel', function (editor, selection, inString, inComment) {
                console.log(editor, selection, inString, inComment);
                 return 'some value '
            });