本文介绍了拼错的Ace编辑器选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经实现了PHP的Ace编辑器设置(工作正常),但是当我尝试使用Ace的API设置其他选项时,我会在控制台中收到警告。
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
任何帮助将不胜感激。
推荐答案
- 您需要包含您使用的扩展程序的脚本文件,请参阅
- 选项名称是
enableLiveAutocompletion
而不是enableLiveAutoComplete
- 选项名称没有
设置
,所以它应该是highlightActiveLine
- 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
- option name is
"enableLiveAutocompletion"
instead of"enableLiveAutoComplete"
https://github.com/ajaxorg/ace/blob/v1.1.4/lib/ace/ext/language_tools.js#L186 - options names do not have
set
in them so it should behighlightActiveLine
您可以通过运行 Object.keys(编辑。$选项)
这篇关于拼错的Ace编辑器选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!