问题描述
我要开发的是一个网络环境应用程序,它将允许用户编写和语法检查自己的python代码。到目前为止,我已经使用python模式将嵌入到我的应用程序中。我的问题是ace不包含用于python语法检查的javascript库,以便通过使用工作程序来实现它,如此处。
What I am trying to develop is a web-environment app which will let user write and syntax check his own python code. To the moment, I have embedded ACE editor to my app using the python mode. My problem is that ace does not include a javascript lib for python syntax check in order to implement it by using workers as described here How to integrate syntax check in Ace Editor using custom mode?.
通过我的搜索中,我找到了或。语法检查都是用python编写的。
使用在线检查器或连接到服务器以执行检查的选项对我不起作用,因为我的应用程序的场景是在ace上书写时提供python语法检查(即使没有互联网连接)
Through my search I have found modules like pyflakes or pylint. for syntax check which are both written in python.The options of using an online checker, or connecting to the server in order to execute the check do not work for me since the scenario of my app is to provide python syntax check (even without internet connection) while writing on ace.
所以,我要问的是是否存在可以与网络嵌入式ace编辑器一起使用的python语法检查器?
So, what I am asking is if there is a syntax checker for python that could be used along with a web embedded ace editor?
谢谢
推荐答案
可能会有所帮助,因为它已将python2 lexer编译为带有emscripten的javascript,并且可以显示基本错误。
https://github.com/ajaxorg/ace/pull/1174 may be somewhat helpful, as it has python2 lexer compiled to javascript with emscripten, and can show basic errors.
也许可以通过将pylint编译为javascript来创建功能更全的版本,但是我知道的所有python-> js编译器都太有限了,并且可以编译整个Python到Webassembly可能会导致捆绑包太大。
It may be possible to create a more full featured version by compiling pylint to javascript, but all python->js compilers i know are too limited, and compiling whole python to webassembly may result in too big bundle.
这篇关于ace编辑器中的Python语法检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!