最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Misspelled Ace Editor Options - Stack Overflow

programmeradmin1浏览0评论

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.

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.

Share Improve this question asked Jul 9, 2014 at 10:28 Harri Bell-ThomasHarri Bell-Thomas 6841 gold badge7 silver badges18 bronze badges 3
  • 1 Try setting the options to the session? – EaterOfCode Commented Jul 9, 2014 at 10:36
  • 1 I tried that ( ie. phpeditor.getSession().setOptions({ ... }); ) and still got the same warning messages. Thanks for the idea though! – Harri Bell-Thomas Commented Jul 9, 2014 at 11:08
  • 1 All of the session options can be set from editor, besides none of the misspelled options are session options github.com/ajaxorg/ace/blob/v1.1.4/lib/ace/… – a user Commented Jul 9, 2014 at 11:11
Add a comment  | 

1 Answer 1

Reset to default 20
  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)

发布评论

评论列表(0)

  1. 暂无评论