Python syntax check in ace editor

青春壹個敷衍的年華 提交于 2019-12-24 11:28:28

问题


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?.

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.

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?

Thanks


回答1:


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.

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.



来源:https://stackoverflow.com/questions/54437738/python-syntax-check-in-ace-editor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!