What to use for finding as many syntax errors as possible.

Thomas Passin list1 at tompassin.net
Tue Oct 11 17:45:25 EDT 2022


On 10/11/2022 5:09 PM, Thomas Passin wrote:
<snip>
> The OP wants to get help with problems in 
> his files even if it isn't perfect, and I think that's reasonable to 
> wish for.  The link to a post about the lezer parser in a recent message 
> on this thread is partly about how a real, practical parser can do some 
> error correction in mid-flight, for the purposes of a programming editor 
> (as opposed to one that has to build a correct program).

One editor that seems to do what the OP wants is Visual Studio Code.  It 
will mark apparent errors - not just syntax errors - not limited to one 
per page.  Sometimes it can even suggest corrections.  I personally 
dislike the visual clutter the markings impose, but I imagine I could 
get used to it.

VSC uses a Microsoft system they call "PyLance" - see

https://devblogs.microsoft.com/python/announcing-pylance-fast-feature-rich-language-support-for-python-in-visual-studio-code/

Of course, you don't get something complex for free, and in this case 
the cost is having to run a separate server to do all this analysis on 
the fly.  However, VSC handles all of that behind the scenes so you 
don't have to.

Personally, I'd most likely go for a decent programming editor that you 
can set up to run a program on your file, use that to run a checker, 
like pyflakes for instance, and run that from time to time.  You could 
run it when you save a file.  Even if it only showed one error at a 
time, it would make quick work of correcting mistakes.  And it wouldn't 
need to trigger an entire tool chain each time.

My editor of choice for setting up helper "tools" like this on Windows 
is Editplus (non-free but cheap and very worth it), and I have both 
py_compile and pyflakes set up this way in it.  However, as I mentioned 
in an earlier post, the Leo Editor 
(https://github.com/leo-editor/leo-editor) does this for you 
automatically when you save, so it's very convenient.  That's what I 
mostly work in.


More information about the Python-list mailing list