securingsincity/react-ace

Adding completers and Mutliple editors cause completers to fire multiple times

Open

#158 opened on 2016年11月16日

GitHub で見る
 (3 comments) (0 reactions) (0 assignees)JavaScript (3,859 stars) (615 forks)batch import
Needs Examplebughelp wanted

説明

I don't know if this is the correct way to add completers to the editor, I haven't seen any documentation on the right way to do it using react-ace via brace in a component.

I'm adding them in the onLoad of the editor; I have multiple editors on the page. When multiple editors are loaded, the completers fire for each one loaded. The editor results in duplicate completions.

Here is how they are loaded in the onLoad event.

var completers = [ 
    { 
        name: 'name', 
        value: 'val', 
        score: 100, 
        meta: 'item' 
    },
    ...
];

editor.completers.push({
    getCompletions: function(editor, session, pos, prefix, callback) {
        callback(null, completers);
    }
});

I'm not sure if this a bug or an issue with my implementation.

Thanks for the help in advanced.

コントリビューターガイド