admin管理员组文章数量:1221020
I would like to know if it's possible to enable auto-completion while user is typing in editor ace.js. At the moment in my project auto-completion is enabled when user type: ctrl + space . Then, is possible adding some keywords in the auto-completion list?
Thanks
I would like to know if it's possible to enable auto-completion while user is typing in editor ace.js. At the moment in my project auto-completion is enabled when user type: ctrl + space . Then, is possible adding some keywords in the auto-completion list?
Thanks
Share Improve this question asked Nov 15, 2013 at 11:31 Edge7Edge7 6811 gold badge16 silver badges35 bronze badges2 Answers
Reset to default 17For triggering autocomplete use
editor.commands.on("afterExec", function(e){
if (e.command.name == "insertstring"&&/^[\w.]$/.test(e.args)) {
editor.execCommand("startAutocomplete")
}
})
For addidng some keywords you can either add another completer to the editor or override getCompletions method on the mode.
It's already built in! See the options that I chose under editor.setOptions
:
var langTools = ace.require("ace/ext/language_tools");
var editor = ace.edit("editor");
editor.setTheme("ace/theme/monokai");
editor.getSession().setMode("ace/mode/yaml");
editor.setOptions({
enableBasicAutocompletion: true,
enableSnippets: true,
enableLiveAutocompletion: true
});
本文标签: javascriptautocompletion in acejs editorStack Overflow
版权声明:本文标题:javascript - auto-completion in ace.js editor - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1739287356a2156528.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论