Python syntax check in ace editor

2019-08-27 16:14发布

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条回答
冷血范
2楼-- · 2019-08-27 16:36

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.

查看更多
登录 后发表回答