我已经实现了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
});
以下是我得到的控制台警告;
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
非常感谢任何帮助。
答案 0 :(得分:14)
"enableLiveAutocompletion"
,而非"enableLiveAutoComplete"
https://github.com/ajaxorg/ace/blob/v1.1.4/lib/ace/ext/language_tools.js#L186 set
,因此它应为highlightActiveLine
您可以通过运行Object.keys(editor.$options)