我希望仅当我使用 Cntrl-Spacebar
时才显示建议。他们的文档有点缺乏。
最佳答案
您需要设置以下变量:
enableBasicAutocompletion:true
enableLiveAutocompletion:false
仅在按Cntrl - Spacebar
时实现自动完成。
检查此片段以进行现场演示:
var langTools = ace.require("ace/ext/language_tools");
var editor = ace.edit("editor");
editor.setOptions({
enableBasicAutocompletion: true,
enableLiveAutocompletion: false
});
<html>
<body>
<div id="editor" style="height: 500px; width: 800px">Type in a word like "will" below and press ctrl+space to get "auto completion"</div>
<div id="commandline" style="position: absolute; bottom: 10px; height: 20px; width: 800px;"></div>
</body>
<script src="https://rawgithub.com/ajaxorg/ace-builds/master/src/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="https://rawgithub.com/ajaxorg/ace-builds/master/src/ext-language_tools.js" type="text/javascript" charset="utf-8"></script>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
</html>
关于javascript - 如何防止 Ace Editor 在我键入时自动完成?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31298936/