在我的web应用程序中,我使用的ace编辑器具有python模式,如下所示:
var editor = ace.edit('aceEditor');
editor.setTheme("ace/theme/monokai");
editor.getSession().setMode("ace/mode/python");
editor.getSession().setUseWorker(false);
editor.setHighlightActiveLine(false);
editor.setShowPrintMargin(false);
ace.require("ace/ext/language_tools");
editor.setOptions({
enableBasicAutocompletion: true,
enableSnippets: true
});
editor.setBehavioursEnabled(true);
editor.setValue(`n=int(input("Enter the number of elements to be inserted: "))
a=[]
for i in range(0,n):
elem=int(input("Enter element: "))
a.append(elem)
avg=sum(a)/n
prin("Average of elements in the list",round(avg,2))`, -1);
^{pr2}$
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.2/ace.js"></script>
<div id="aceEditor"></div>
如果用户错误地键入了print
,我需要显示如下验证:
ace编辑器对HTML、JavaScript进行语法验证/检查。但在我的例子中,我需要显示python的错误,并且我愿意使用支持我的需求的其他编辑器,我也愿意使用react-ace而且,在react ace中,在react-ace上找不到解决方案演示
我遇到了这个Issue,其中声明Cloud9使用pylint来显示语法错误。如果是这样的话,如何在web应用中启用它,我猜ace没有内置的支持?这方面有什么帮助/指南吗
我可以想出几个选择:
相关问题 更多 >
编程相关推荐