Misspelled Ace Editor Options

冷暖自知 提交于 2020-01-12 05:30:09

问题


I have implemented an Ace editor setup for PHP (which is working fine), but when I try to set additional options using Ace's API, I receive warnings in the console.

Here is the code used to init the editor and try to set the options;

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
    });

And here are the console warnings I get;

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

Any help will be greatly appreciated.


回答1:


  1. you need to include script files for extensions you use see https://github.com/ajaxorg/ace-builds/blob/v1.1.4/demo/autocompletion.html#L28
  2. option name is "enableLiveAutocompletion" instead of "enableLiveAutoComplete" https://github.com/ajaxorg/ace/blob/v1.1.4/lib/ace/ext/language_tools.js#L186
  3. options names do not have set in them so it should be highlightActiveLine

you can see list of all available options by running Object.keys(editor.$options)



来源:https://stackoverflow.com/questions/24651222/misspelled-ace-editor-options

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!