拼错的Ace编辑器选项

Har*_*mas 6 javascript ace-editor

我已经实现了PHP的Ace编辑器设置(工作正常),但是当我尝试使用Ace的API设置其他选项时,我在控制台中收到警告.

这是用于初始化编辑器并尝试设置选项的代码;

ace.require("ace/ext/language_tools");
ace.require("ace/ext/emmet");

// PHP
var phpeditor = ace.edit("php_inc");
phpeditor.setTheme("ace/theme/dreamweaver");
phpeditor.getSession().setMode("ace/mode/php");
phpeditor.setOptions({
        enableSnippets: true,
        enableLiveAutoComplete: true,
        enableBasicAutocompletion: true,
        showPrintMargin: settings.showPrintMargin,
        useSoftTabs: false,
        fontSize: settings.fontSize,
        showInvisibles: settings.showInvisibles,
        behavioursEnabled: settings.behavioursEnabled,
        tabSize: settings.tabSize,
        useWrapMode: settings.useWrapMode,
        useWorker: settings.useWorker,
        setHighlightActiveLine: false,
        enableEmmet: true
    });
Run Code Online (Sandbox Code Playgroud)

以下是我得到的控制台警告;

misspelled option "enableSnippets" ace.js?ver=3.9.1:5207
misspelled option "enableLiveAutoComplete" ace.js?ver=3.9.1:5207
misspelled option "enableBasicAutocompletion" ace.js?ver=3.9.1:5207
misspelled option "setHighlightActiveLine" ace.js?ver=3.9.1:5207
misspelled option "enableEmmet" ace.js?ver=3.9.1:5207
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激.

a u*_*ser 14

  1. 你需要包含你使用的扩展的脚本文件,请参阅https://github.com/ajaxorg/ace-builds/blob/v1.1.4/demo/autocompletion.html#L28
  2. 选项名称"enableLiveAutocompletion"而不是"enableLiveAutoComplete" https://github.com/ajaxorg/ace/blob/v1.1.4/lib/ace/ext/language_tools.js#L186
  3. 选项名称中没有set,所以它应该是highlightActiveLine

您可以通过运行查看所有可用选项的列表 Object.keys(editor.$options)