javascript - 如何防止 Ace Editor 在我键入时自动完成?

标签 javascript autocomplete ace-editor

我希望仅当我使用 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/

相关文章:

javascript - 理解 React 中的状态输入

c++ - 仅在特定字符后使用键映射

ace-editor - 如何使用 ace-builds 为 ace 编辑器使用镜像工作器

java - 如何在 android 的自动完成 TextView 中设置联系人号码?

javascript - 如何使用 Webpack 和 noParse 选项要求 'ace-builds/ace'

javascript - Ace Editor 手动添加片段

javascript - Switch 函数运行但大小写被忽略

javascript - 无法在 Firebase DB 中正确保存

JavaScript 循环遍历所有带有标记名、警报的元素

google-maps - 如何从 React Native 中的谷歌地图自动完成获取地址