It is easy to customize the code completion in the ace editor,
The following code will do the autosuggestion in the editor.
The following code will do the autosuggestion in the editor.
editor = ace.edit("editor")
editor.setOptions({
// mode: "ace/mode/javascript",
enableBasicAutocompletion: true
});
editor.completers.push({
getCompletions: function(editor, session, pos, prefix, callback) {
callback(null, [
{value: "foo", score: 1000, meta: "custom"},
{value: "bar", score: 1000, meta: "custom"}
]);
}
})
But the above code will do autosuggestion with the completion we have provided with the words available in the editor,
This code is done in the ace/ext/language_tools.js
You can customize the TextCompleter in the file language_tools.js
In line no 70 if you remove the textCompletor, you can complete control according to your recommendation.
example
var completers = [snippetCompleter, keyWordCompleter];//textCompleter
No comments:
Post a Comment