更新时间:2023-02-04 19:15:38
首先,激活您提到的 enableLiveAutocompletion,并且您还必须确保定义了 enableBasicAutocompletion
并且设置为 true
(见下文).
First, Activate the enableLiveAutocompletion as you mentioned, and you also have to ensure enableBasicAutocompletion
is defined and set to true
(see below).
editor.session.setMode("ace/mode/sql");
editor.setOptions({
enableBasicAutocompletion: true,
enableSnippets: true,
enableLiveAutocompletion: true
});
要添加新的完成者,请执行 eemp 在 github 上提到的操作(这里).
To add a new completer, do what eemp mentioned on github (here).
let langTools = ace.require('ace/ext/language_tools');
然后使用 addCompleter
方法添加如下定义的补全:
Then use the addCompleter
method to add the completions as defined below:
var customCompleter = {
getCompletions: function(editor, session, pos, prefix, callback) {
// your code
/* for example
* let TODO = ...;
* callback(null, [{name: TODO, value: TODO, score: 1, meta: TODO}]);
*/
}
}
langTools.addCompleter(customCompleter);
你也可以去看看以下内容:
You can also go have a look at the following: